rejetto forum
Software => HFS ~ HTTP File Server => Programmers corner => Topic started by: Mars on March 09, 2010, 01:35:12 PM
-
Here is craftiness to fill the log with the macro RENAME
create an new real folder
create a file named old.txt
put the attached hfs.diff.tpl into the new folder
and include the [on macro rename] section in the hfs.events
{.add to log|hfs.diff.tpl: macro rename|color=red.}
{.rename|%folder-resource%\old.txt|%folder-resource%\new.txt|recursive=1.}
[+on macro rename]
{.add to log|hfs.events: macro rename
%old-name%
%new-name%
|color=red.}
{.rename|%new-name%|%old-name%|recursive=1.}
It is as in a play of ping-pong :D
old-name >> new-name >> old-name >> new-name >> old-name >> new-name >> ........
It is beautiful the recursion, especially when we do not know where it is necessary to use it. ;D ;D
HFS BUILD 244
+ running a {.rename.} during [on macro rename] won't fire the event again (but you can override this with parameter "recursive")
-
you may need multiple automatic renaming rules. in such case you may need to control when to stop recursion.
if you are using the "recursive" parameter then you are supposed to know what you are doing.
you can use an {.if.} to decide to stop recursion.
point is: it's off by default.
if you want to deliberately make an infinite loop there is an easier way: {.while|timeout=0.} ;)