rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: hutnut on February 11, 2010, 05:23:28 PM

Title: programmatically add/create .vfs file
Post by: hutnut on February 11, 2010, 05:23:28 PM
Is there a way to programmatically add entries to the .vfs file. I'd like to create a folder in an application and dynamically alter the .vfs file to support this new folder. A cursory look at the the .vfs file looks proprietary. Am I missing something or are there other options?
Title: Re: programmatically add/create .vfs file
Post by: rejetto on February 12, 2010, 09:42:21 AM
from your application just run:
hfs <fullpath-path-to-the-folder-you-want-to-add>
Title: Re: programmatically add/create .vfs file
Post by: hutnut on February 15, 2010, 08:31:28 PM
Thanks. This solution does add the given folder to HFS but immediately prompts the user as to whether this is a virtual or real folder. Can this prompt be avoided.
Title: Re: programmatically add/create .vfs file
Post by: Wasserfloh on February 15, 2010, 09:04:18 PM
Menu > Virtual File System > Adding folder > ...
Title: Re: programmatically add/create .vfs file
Post by: hutnut on February 15, 2010, 09:14:35 PM
Thanks. I just found it when you replied.
Title: Re: programmatically add/create .vfs file
Post by: hutnut on February 16, 2010, 02:48:02 PM
When adding this new folder, can I give it a different name dynamically? For example, give c:\test1\patchfiles a name of "test1" and give c:\test2\patchfiles a name of "test2". I can perform a rename via the UI but can I do it programmatically. Thanks.
Title: Re: programmatically add/create .vfs file
Post by: rejetto on February 16, 2010, 03:54:28 PM
the scripting language is able to do this.
there's a command called "add folder".
read more at http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands#Virtual_File_System_manipulation

at the moment there's no designed way to run a script at command line, it will come in future versions.
that's how you can workaround this:
- create a virtual folder called "whatyouwant" (consider hiding it)
- right click on it > properties > diff template
- put your script there, and you will be able to call this script by accessing url http://localhost/~whatyouwant

if you don't know how to access the url at command line, download an utility like wget (http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-bin.zip), so that you can just run: wget http:/etcetcetc

at this point, only left problem is to communicate the path and possibly other stuff.
a good option would be if the script determines this data itself, and there's no need to communicate.
otherwise, the easiest way would be to add your data to the url, when calling through
wget http://localhost/~whatyouwant?path=C:\test&trueName=foo
you will access path and trueName in the script through {.?path.} and {.?trueName.}