FileSystem

This extension contains functions for interacting with a file system  Related Links: Extension Overview, DekiScript Overview, Extension Demos.

Assembly: mindtouch.deki.services
SID: http://services.mindtouch.com/deki/draft/2008/03/filesystem
License: none

This service requires Deki Wiki 1.9.1 or later.

To enable this extension, follow these steps:

  1. Go to Service management in the Control Panel of your wiki.
  2. Under Add Service, click on Local, and select type Extension.
  3. Enter a description and the extension SID: http://services.mindtouch.com/deki/draft/2008/03/filesystem
  4. Add any additional configuration settings that are required by the extension (see below).
  5. Click on add service.

Configuration:

Before the FileSystem service can be used, it must be configured.

Config Key Description
folder Specifies the file system folder (examples:  z:\, \\myshare\drive )


If you need to configure multiple file systems for the same wiki, register this extension once for each file system.  Use the following preference to specify a unique namespace value for each registration.  Invoke the service using this value instead of filesystem.  For example, if you set namespace=filesystem1, you would invoke the service with filesystem1.tree("...") instead of filesystem.tree("...").  

Functions:



filesystem.tree(folder : str, topDirectoryOnly : bool?, pattern : str) : xml

Displays a browsable file system tree.

Parameters:

Name Type Description
folder
str The top directory
topDirectoryOnly
bool?
Optional.  Specifies whether to include all directories or only the top directory (default: false)
pattern
str
Optional.  Search pattern (default: nil)

Samples:


Output

To display the contents of the root directory:

{{ filesystem.tree("/") }}
FileSystem1.PNG

To display a list of files in the root directory:

{{ filesystem.tree("/", true) }}
FileSystem2.PNG

To search opt/deki/src/services/Deki for files that end with ".cs":

{{ filesystem.tree("opt/deki/src/services/Deki", false, "*.cs") }}
FileSystem3.PNG
Tag page
Viewing 5 of 5 comments: view all
any way to limit this extension to only show files under a given directory? eg only files under /var/www/public for instance? It seems the 'folder' config should do this, but it doesn't (deki wiki 8.05)
Posted 13:21, 20 May 2008
The 'topDirectoryOnly' parameter allows you to limit the results to only the top directory (no sub-directories).
Posted 20:00, 20 May 2008
Neat thingy. But! Our wiki is not public and this extension doesn't take permissions into account. Everybody can fetch whatever from our private storage provided they know correct URL. Any way to make this work properly in our scenario?
Posted 12:16, 17 Jun 2008
I agree. The issue is once the extension is running anyone can call it and override the directory specified with the "folder" key. I set it up so it points to a shared directory tree and then the user calls it with folder of "/" and now they can browse the entire file structure, not just the one folder tree I wanted. Limiting to the top directory is no solution because there are files there I don't want everyone to fetch.
Posted 20:31, 22 Oct 2008
This might be (well) beyond the scope of this extension, which I see as being potentially very useful as it stands already, but I am much more interested in *searching* a filesystem than browsing it. Is there any possibility of that? edited 17:45, 7 Nov 2008
Posted 17:44, 7 Nov 2008
Viewing 5 of 5 comments: view all
You must login to post a comment.
Powered by MindTouch Deki v.8.08.2