I have a loop that downloads all the files in a directory but a need to create a variable that will hold the name of every file downloaded in the loop so that i can later add this variable in an email. any ideas
Example:
The following files have been downloaded:
file1.txt
file2.txt
file3.txt
Arrays
Arrays
You may use Write Text File action with append option. If you want save the filename only (without path) use the expression like this: {ExtractFileName({ftpfile})}.
Next you can use the File Loop or TextFile(<File_Name>) macrofunction.
See example below:
;**********************
;* RoboTask Task file *
;* Do not edit! *
;**********************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1664541561
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task179"
Hide=INTEGER|0
ID=INTEGER|1710315732
Name=STRING|"Download from FTP demo (1)"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
[Actions\Action1]
ActionID=STRING|"A_FTP_LOGON"
Enabled=INTEGER|-1
Name=STRING|"FTP Log On"
Params=FOLDER
[Actions\Action1\Params]
anonymous=STRING|"1"
host=STRING|"localhost"
passive=STRING|"0"
password=STRING|"42310383162884337286400984055142142"
port=STRING|"21"
username=STRING|"anonymous"
[Actions\Action2]
ActionID=STRING|"A_FTP_TRANSFERTYPE"
Enabled=INTEGER|-1
Name=STRING|"FTP Transfer Type"
Params=FOLDER
[Actions\Action2\Params]
binary=STRING|"1"
[Actions\Action3]
ActionID=STRING|"A_FTP_FILELOOP"
Enabled=INTEGER|-1
Name=STRING|"FTP File Loop"
Params=FOLDER
[Actions\Action3\Params]
filenameonly=STRING|"0"
folder=STRING|"/myweb/*.*"
sizesave=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"0"
varname=STRING|"FTPFILE"
[Actions\Action4]
ActionID=STRING|"A_FTP_DOWNLOAD"
Enabled=INTEGER|-1
Name=STRING|"FTP Download"
Params=FOLDER
[Actions\Action4\Params]
file=STRING|"{FTPfile}"
folder=STRING|"C:\ftpfiles"
[Actions\Action5]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file c:\ftpfiles\list.txt"
Params=FOLDER
[Actions\Action5\Params]
fileexists=STRING|"1"
filname=STRING|"c:\ftpfiles\list.txt"
line0=STRING|"{ExtractFileName({ftpfile})}"
linecount=STRING|"1"
[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action7]
ActionID=STRING|"A_FTP_LOGOFF"
Enabled=INTEGER|-1
Name=STRING|"FTP Log Off"
Next you can use the File Loop or TextFile(<File_Name>) macrofunction.
See example below:
;**********************
;* RoboTask Task file *
;* Do not edit! *
;**********************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1664541561
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task179"
Hide=INTEGER|0
ID=INTEGER|1710315732
Name=STRING|"Download from FTP demo (1)"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
[Actions\Action1]
ActionID=STRING|"A_FTP_LOGON"
Enabled=INTEGER|-1
Name=STRING|"FTP Log On"
Params=FOLDER
[Actions\Action1\Params]
anonymous=STRING|"1"
host=STRING|"localhost"
passive=STRING|"0"
password=STRING|"42310383162884337286400984055142142"
port=STRING|"21"
username=STRING|"anonymous"
[Actions\Action2]
ActionID=STRING|"A_FTP_TRANSFERTYPE"
Enabled=INTEGER|-1
Name=STRING|"FTP Transfer Type"
Params=FOLDER
[Actions\Action2\Params]
binary=STRING|"1"
[Actions\Action3]
ActionID=STRING|"A_FTP_FILELOOP"
Enabled=INTEGER|-1
Name=STRING|"FTP File Loop"
Params=FOLDER
[Actions\Action3\Params]
filenameonly=STRING|"0"
folder=STRING|"/myweb/*.*"
sizesave=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"0"
varname=STRING|"FTPFILE"
[Actions\Action4]
ActionID=STRING|"A_FTP_DOWNLOAD"
Enabled=INTEGER|-1
Name=STRING|"FTP Download"
Params=FOLDER
[Actions\Action4\Params]
file=STRING|"{FTPfile}"
folder=STRING|"C:\ftpfiles"
[Actions\Action5]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file c:\ftpfiles\list.txt"
Params=FOLDER
[Actions\Action5\Params]
fileexists=STRING|"1"
filname=STRING|"c:\ftpfiles\list.txt"
line0=STRING|"{ExtractFileName({ftpfile})}"
linecount=STRING|"1"
[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action7]
ActionID=STRING|"A_FTP_LOGOFF"
Enabled=INTEGER|-1
Name=STRING|"FTP Log Off"
Arrays
It is not possible to add line to user variable directly now. We'll add this feature in next version.
But you can create a multiline text by using the Write Text File action. Later you can load this text to variable by means of TextFile macrofunction.
But you can create a multiline text by using the Write Text File action. Later you can load this text to variable by means of TextFile macrofunction.
Arrays
Sorry, I was mistaken.Next you can use the File Loop or TextFile(<File_Name>) macrofunction.
I wanted to say: Next you can use the Text Loop action or TextFile(<File_Name>) macrofunction.