Rename folders

Discuss RoboTask here
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Rename folders

Post by Oleg »

You should get the list of folders first.
Next you should sort the folder list in descending order .
At last rename folders in the text loop


See the example below:
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|2099193306
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task69"
Hide=INTEGER|0
ID=INTEGER|150137837
LogOnAsUser=INTEGER|1
Name=STRING|"rename folders 3"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=FOLDER
Action18=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""OLDPATHNAME"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"OLDPATHNAME"

[Actions\Action10]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|0
Name=STRING|"Break"

[Actions\Action11]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action11\Params]
destvar=STRING|"OLDPATHNAME"
line0=STRING|"{text}"
linecount=STRING|"1"
sourcetext=STRING|"1"

[Actions\Action12]
ActionID=STRING|"A_STR_POS"
Enabled=INTEGER|-1
Name=STRING|"STR Pos"
Params=FOLDER

[Actions\Action12\Params]
case=STRING|"0"
from=STRING|"1"
search=STRING|"-"
source=STRING|"{ExtractFileName({OldPathName})}"
variable=STRING|"APos"

[Actions\Action13]
ActionID=STRING|"A_STR_DELETE"
Enabled=INTEGER|-1
Name=STRING|"STR Delete"
Params=FOLDER

[Actions\Action13\Params]
amount=STRING|"{APos}"
from=STRING|"1"
source=STRING|"{ExtractFileName({OldPathName})}"
variable=STRING|"NewPathName"

[Actions\Action14]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action14\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"0"
value1=STRING|"{ExtractFileName({OldPathName})}"
value2=STRING|"{NewPathName}"

[Actions\Action15]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action15\Params]
message=STRING|"File {OldPathName} is renaming to {NewPathName}"
type=STRING|"3"

[Actions\Action16]
ActionID=STRING|"A_FOLDER_RENAME"
Enabled=INTEGER|-1
Name=STRING|"Rename Folder ""{OldPathName}"""
Params=FOLDER

[Actions\Action16\Params]
folder=STRING|"{OldPathName}"
newfolder=STRING|"{NewPathName}"

[Actions\Action17]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action18]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""NEWPATHNAME"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"NEWPATHNAME"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""APOS"" with value """""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"APOS"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""TEXT"" with value """""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"TEXT"

[Actions\Action5]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action5\Params]
createmode=STRING|"1"
date1=STRING|"20100105"
date2=STRING|"20100105"
destvar=STRING|"OLDPATHNAME"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"D:\3dmap\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""TEXT"" with value ""{Text}{OldPathName}{eol}"""
Params=FOLDER

[Actions\Action6\Params]
expand=STRING|"1"
varname=STRING|"TEXT"
varvalue=STRING|"{Text}{OldPathName}{eol}"

[Actions\Action7]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action8]
ActionID=STRING|"A_FILE_SORTTEXT"
Enabled=INTEGER|-1
Name=STRING|"Sort Text"
Params=FOLDER

[Actions\Action8\Params]
assignvar=STRING|"1"
case=STRING|"0"
line00000000=STRING|"{text}"
linecount=STRING|"1"
savetofile=STRING|"0"
sortmode=STRING|"1"
sourcekind=STRING|"1"
variable=STRING|"text"

[Actions\Action9]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|0
Name=STRING|"Show ""{text}"""
Params=FOLDER

[Actions\Action9\Params]
icon=STRING|"1"
msg0=STRING|"{text}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Rename folders

Post by rice1973 »

Works!
Post Reply