1 file to multiple folders? How?

Discuss RoboTask here
Post Reply
anthonyystwarty
Posts: 52
Joined: Fri Dec 30, 2022 2:43 am

1 file to multiple folders? How?

Post by anthonyystwarty »

Hello, my greetings. In the copy/move action, can I copy or move multiple files from different sources to multiple folders, and vice versa? how do I do? 1 file for multiple folders? Thanks
Oleg
Site Admin
Posts: 3135
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: 1 file to multiple folders? How?

Post by Oleg »

how do I do?
Use loops.
Look at the example below how to copy one file to multiple folders
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.
Next you can see it (and edit it) in the the task editor

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task77"
Hide=INTEGER|0
ID=INTEGER|2010785613
LogOnAsUser=INTEGER|1
Name=STRING|"One file to multiple folders"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FileName"" with value ""D:\incoming\test.txt """
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"FileName"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"FileName"
varvalue=STRING|"D:\incoming\test.txt "

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""Folders"" with value ""D:\dest\folder1"""
Params=FOLDER

[Actions\Action2\Params]
_rt_variables_produced=STRING|"Folders"
expand=STRING|"0"
linecount=STRING|"4"
varname=STRING|"Folders"
varvalue=STRING|"D:\dest\folder1"
varvalue00000001=STRING|"D:\dest\folder2"
varvalue00000002=STRING|"D:\dest\folder3"
varvalue00000003=STRING|"D:\dest\folder4"

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

[Actions\Action3\Params]
_rt_variables_produced=STRING|"TargetFolder"
delimiter_no=STRING|"0"
destvar=STRING|"TargetFolder"
line0=STRING|"{Folders}"
linecount=STRING|"1"
quote_char=STRING|"0"
sourcetext=STRING|"1"
strict_delim=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action4\Params]
destdir=STRING|"{TargetFolder}"
f_count=STRING|"1"
file0=STRING|"{FileName}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"0"
output=STRING|"0"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"

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

[\Comment]
s1=Copy one file to several folders
To copy many files to many folders use nested loops. Look at the next example. It copied all *.TXT files from folder d:\incoming to multiple folders

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task90"
Hide=INTEGER|0
ID=INTEGER|-1032997912
LogOnAsUser=INTEGER|1
Name=STRING|"Many files to multiple folders"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SourceFolder"" with value ""D:\incoming"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"SourceFolder"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"SourceFolder"
varvalue=STRING|"D:\incoming"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""Folders"" with value ""D:\dest\folder1"""
Params=FOLDER

[Actions\Action2\Params]
_rt_variables_produced=STRING|"Folders"
expand=STRING|"0"
linecount=STRING|"4"
varname=STRING|"Folders"
varvalue=STRING|"D:\dest\folder1"
varvalue00000001=STRING|"D:\dest\folder2"
varvalue00000002=STRING|"D:\dest\folder3"
varvalue00000003=STRING|"D:\dest\folder4"

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

[Actions\Action3\Params]
_rt_variables_produced=STRING|"FileName"
createmode=STRING|"1"
date1=STRING|"20230618"
date2=STRING|"20230618"
destvar=STRING|"FileName"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{SourceFolder}\*.txt"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

[Actions\Action4\Params]
_rt_variables_produced=STRING|"TargetFolder"
delimiter_no=STRING|"0"
destvar=STRING|"TargetFolder"
line0=STRING|"{Folders}"
linecount=STRING|"1"
quote_char=STRING|"0"
sourcetext=STRING|"1"
strict_delim=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action5\Params]
destdir=STRING|"{TargetFolder}"
f_count=STRING|"1"
file0=STRING|"{FileName}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"0"
output=STRING|"0"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"

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

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

[\Comment]
s1=Copy all TXT files from d:\incoming to to several folders
Oleg Yershov
anthonyystwarty
Posts: 52
Joined: Fri Dec 30, 2022 2:43 am

Re: 1 file to multiple folders? How?

Post by anthonyystwarty »

Hello, I'm going to study Variables, my knowledge is poor.. Você é excelente.
Post Reply