Page 1 of 1
Rename Folders
Posted: Thu Dec 11, 2008 6:12 am
by kivanck
Hi ! I couldn't figure out how to do this but I guess that must be easy to do! All I want to do is to rename all subfolders in a specific folder by adding [ before the folder name and ] after the folder name.I mean "Folder 1" should be "[Folder 1]" after the task. Can you guys help me on this? Thanks a lot ...KK
Rename Folders
Posted: Thu Dec 11, 2008 8:52 am
by Oleg
It's possible. See task below.
save the text of the task into file and use menu "Task | Import" in order to import into RoboTask
The sorting of the list is necessary (between the loops), because we need to rename the folders from bottom of folder tree to top.
First loop retrieves the folder tree and second loop renames folders from bottom.
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1380072790
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task742"
Hide=INTEGER|0
ID=INTEGER|340972587
LogOnAsUser=INTEGER|1
Name=STRING|"rename subfolders"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|0
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
[Actions\Action1]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER
[Actions\Action1\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
file0=STRING|"c:\incoming\list.txt"
subdir=STRING|"0"
ToRecycleBin=STRING|"0"
[Actions\Action2]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action2\Params]
createmode=STRING|"1"
date1=STRING|"20081211"
date2=STRING|"20081211"
destvar=STRING|"C_FOLDER"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\incoming\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action3]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file c:\incoming\list.txt"
Params=FOLDER
[Actions\Action3\Params]
fileexists=STRING|"1"
filname=STRING|"c:\incoming\list.txt"
line0=STRING|"{c_folder}"
linecount=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action5]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""cmd.exe /c sort /r c:\incoming\list.txt > c:\incoming\slist.txt"""
Params=FOLDER
[Actions\Action5\Params]
params=STRING|"/c sort /r c:\incoming\list.txt > c:\incoming\slist.txt"
program=STRING|"cmd.exe"
runas=STRING|"0"
wait=STRING|"2"
[Actions\Action6]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action6\Params]
destvar=STRING|"C_LINE"
file=STRING|"C:\incoming\slist.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action7]
ActionID=STRING|"A_FOLDER_RENAME"
Enabled=INTEGER|-1
Name=STRING|"Rename Folder ""{c_line}"""
Params=FOLDER
[Actions\Action7\Params]
folder=STRING|"{c_line}"
newfolder=STRING|"{ExtractFilePath({c_line})}\[{ExtractFileName({c_line})}]"
[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"