rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: CJ on October 03, 2013, 06:28:44 PM

Title: edit vfs
Post by: CJ on October 03, 2013, 06:28:44 PM
hey all,

running 2.3 beta 274 and i'm running into a problem.  right now, i'm using hfs for a company i'm working with.  they have files available for their clients to access, but every client has their own folder.  there are almost 1000 clients...

i'm right in the middle of upgrading the whole company to windows 7 (because 8 is beyond horrible.)  the location of the shared folders is changing because of the new network setup, and i REALLY don't want to have to right-click on 1000 folders (all real, no virtual) to change the location of where the client-accessable data is stored (edit resource function.) 

is there a way that i could edit the hfs.vfs file easily to do a find-and-replace of all of all of the folder locations to change them at once to the new setup?  BTW, i have absolutely NO programming experience, so it would have to be something that could be a script or a way to convert the file to text to be able to open in notepad or something, then convert back when done. 

i dreaded the day when i got hfs up and running for them and found out at THAT time that i had to convert the almost 700 clients that they had then to base64 to input them into the ini file.  thankfully, i found some scripts (after scouring the net for DAYS) that did batch conversions for text to base64, and that helped everything incredibly well.  it also helped that the ini file was in plaintext. 

but now, because of this upgrade, i am faced with this new problem and the vfs file is not so easily workable as the ini is.  if anyone can help me with this, that would be so freaking awesome. 

thanks a lot everyone! everyone here is great. and hfs is the freakin pimp!  kick-ass work rejetto! keep it up, man!
Title: Re: edit vfs
Post by: Mars on October 04, 2013, 10:17:17 AM
By secutity, it is not possible to directly edit the VFS to change paths.
 I guess every real folder of VFS has its individual settings.
instead of re-import each directory, it is possible to edit each resource directly from the VFS maintaining access rights established for each element.

select an item + right click to open context menu --> Edit resource

Title: Re: edit vfs
Post by: CJ on October 04, 2013, 01:17:06 PM
i was afraid that would be the case.  i was just hoping that i wouldn't have to do that about 1000 times.  is everybody ABSOLUTELY SURE that there is NO OTHER way to do this?  i just know that it's going to be a VERY TEDIOUS process and it won't take long to get bug-eyed from it and start making mistakes...

there is absolutely no other way to do it through HFS or to edit the file directly?  if anyone has any ideas (or maybe this could even be a suggestion for a new feature in a future version) please let me know.

thanks everyone!
Title: Re: edit vfs
Post by: rejetto on October 05, 2013, 02:56:17 AM
you can script it.
There's a command
{.set item|/FOLDER|resource=C:\TEST.}


http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands#Virtual_File_System_manipulation
Title: Re: edit vfs
Post by: rejetto on October 05, 2013, 03:00:59 AM
did you already considered the possibility of creating a "junction" in order to keep old paths ?
Title: Re: edit vfs
Post by: CJ on October 06, 2013, 05:29:06 PM
i don't mind scripting it at all.  i've had to do batch copy and paste jobs for stuff like this before.  in fact, one of the biggest was to set up all of the usernames/passwords initially for hfs and it worked great!  but like i said, my programming is minimal at best on a good day and I can't write scripts from scratch, however, i think i know enough to be able to edit a script if someone could get me started. 

for example, if i had three people john, ted, and bob and their p/w were a1, b2, and c3, respectively, could someone write the script that would make the changes from start to finish for this example and then i could just edit it when i got a list of the names into a format that i could work with?  that would be awesome, guys!  thank you very much!  and sorry to be such a novice at this...
Title: Re: edit vfs
Post by: Mars on October 06, 2013, 06:47:13 PM
After a few hours of research and testing, here's a script to go through each element of the VFS and redefine the resource of an element if the directory does not exist in the current path, but there is another definite place

it is only possible to use this script as a special place:

go to MENU --> Debug --> Run Script ...

HFS open a Run Script windows with a RUN button

( don't check Auto run at ....)
HFS create a temporary file named  HFS SCRIPT.TMP  opened in an editor

copy and paste this next script (as it with empty lines) into editor  and save the file without closing the editor

Quote
{.if|{.replace|%20| |{.vfs select.}.}|{.replace|%20| |{.vfs select.}.}
 is a {.if|{.get item|{.replace|%20| |{.vfs select.}.}|resource.}|REAL|VIRTUAL.} Item.|STOP: there are no more elements to deal.}
{.if|{.get item|{.replace|%20| |{.vfs select.}.}|resource.}|{:
Current resource is defined as:
{.get item|{.replace|%20| |{.vfs select.}.}|resource.}
{.if|{.not|{.exists|{.get item|{.replace|%20| |{.vfs select.}.}|resource.}.}.}|{:
this path does not exist, seaching for new destination ...

{.if|{.exists|{.replace|C:\Documents and Settings\admin\desktop\hfs\|L:\hfs\|{.get item|{.replace|%20| |{.vfs select.}.}|resource.}.}.}
|{:{.set item|{.replace|%20| |{.vfs select.}.}|resource={.replace|C:\Documents and Settings\bs\Bureau\|L:\temp\|{.get item|{.replace|%20| |{.vfs select.}.}|resource.}.}.}
ENJOY! the new resource is now:
{.get item|{.replace|%20| |{.vfs select.}.}|resource.}:}|

replace

There is no valid path for this item, you have to edit it manually !!!!
.}:}|
GOOD: this resource exist as real folder.}:}.}
{.vfs select|next.}

In this script we assume that when a resource starts with C:\Documents and Settings\admin\desktop\hfs\  and no longer exists, then we look for a valid destination starting the ressoure by L:\hfs\

Click the Run button to process the next item ....

Return to HFS application and select the root on the vfs

Go to the Run Script windows and click on Run button

one click --> one item, but change is automatic only when needed and destination is valid

 :P ;D




Title: Re: edit vfs
Post by: CJ on October 07, 2013, 04:57:36 PM
hey mars, i tried your script, but did not have any success with it.  i followed what you said word-for-word and replaced my current folder and the new folder lines and ran the script, but nothing seemed to happen.  i also tried rejetto's suggestion, but again, nothing happened.  not sure what i did wrong. (i told you i was no good at this stuff!  :P)

i thank you for the time that you took, mars, but after looking at rejetto's suggestion and the accompanying link, i think that would be the way to go.  a script that i could run that could just be 1 or 2 lines to replace the resource and URL of the folder along the lines of:

{.set item|/FOLDER|resource=C:\TEST.}


http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands#Virtual_File_System_manipulation

would be perfect.  then, i could just copy the script into notepad, paste in the folder list, and do a find and replace and have the whole thing done in a matter of minutes.  would it be hard to write a script with just a couple "example" folders in it that i could just replace the names with my folder list, and then run the script? please let me know soon, guys, and thanks so much for all the help, time, and patience.   :)

btw:  i wanted to also mention that i did not use a URL or resource for the root.  when i first set up hfs, i included a resource and URL for root, but was having problems with login.  when i removed the URL and resource from root, everything worked fine:  file transfers, user logins, everything.  don't know if that matters or not.  when i was looking over the code from mars, it looked like that might make a difference, so i thought i should mention something about it.  anyway, thanks again guys!  :D
Title: Re: edit vfs
Post by: Mars on October 07, 2013, 05:23:02 PM
I would like to know what are the original paths that you want to change and the corresponding global destinations for each

Save your VFS into a file, and in a private message give me a link where i can download it.

rest assured because no informations about the users accounts are stored in this file

zip it with a password before sending your MP

with informations of old path and new path , i can apply my script on your file and return the result by MP
 ;)