Page 1 of 1
FTP File Search?
Posted: Sat Aug 10, 2013 9:23 pm
by acepm2
Hi everyone! While I consider myself new, I'm having a heck of a time trying to search my client's FTP site and download files. What I need to be able to accomplish is the ability to search for any new files that they have uploaded within the last 24 hours. I can log on, change directories, etc. I just cannot seem to grasp how to locate "NEW" files and then download them!!
Can someone please help point me in the right direction??
Thank you!!
Thom
Re: FTP File Search?
Posted: Sun Aug 11, 2013 10:12 am
by Oleg
Look at the example below.
This task writes to task log only files which was updated at last day (24 hours)
You should have BASIC plugin for this task. Download it here:
http://www.robotask.com/downloads/BasicForRoboTask.exe (the link always is on
download page).
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1663346572
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task287"
Hide=INTEGER|0
ID=INTEGER|1525567110
LogOnAsUser=INTEGER|1
Name=STRING|"Date filter on FTP"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action1\Params]
message=STRING|"******** begin ***************"
type=STRING|"3"
[Actions\Action10]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action11]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action12]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action12\Params]
message=STRING|"******** end ***************"
type=STRING|"3"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FILENAME"" with value """""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FILENAME"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FILETIME"" with value """""
Params=FOLDER
[Actions\Action3\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FILETIME"
[Actions\Action4]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""DIFF"" with value """""
Params=FOLDER
[Actions\Action4\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"DIFF"
[Actions\Action5]
ActionID=STRING|"A_SSLFTP_LOGON"
Enabled=INTEGER|-1
Name=STRING|"SSL FTP Log On"
Params=FOLDER
[Actions\Action5\Params]
anonymous=STRING|"1"
host=STRING|"localhost"
passive=STRING|"1"
password=STRING|"42310383162884337286400984055142142"
port=STRING|"21"
proxypassword=STRING|"2488924944267382673325199"
proxytype=STRING|"3"
tlsmode=STRING|"0"
useproxy=STRING|"0"
username=STRING|"anonymous"
usessl2=STRING|"0"
usessl3=STRING|"0"
usestls=STRING|"1"
[Actions\Action6]
ActionID=STRING|"A_SSLFTP_FILELOOP"
Enabled=INTEGER|-1
Name=STRING|"SSL FTP File Loop"
Params=FOLDER
[Actions\Action6\Params]
filenameonly=STRING|"0"
folder=STRING|"*.*"
kind=STRING|"0"
sizesave=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"1"
varname=STRING|"FILENAME"
vartime=STRING|"FILETIME"
[Actions\Action7]
ActionID=STRING|"BASIC_EVALUATE"
Enabled=INTEGER|-1
Name=STRING|"Evaluate"
Params=FOLDER
[Actions\Action7\Params]
expression=STRING|"datediff(""d"", cdate(""{fileTime}""), now)"
variable=STRING|"DIFF"
[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action8\Params]
case=STRING|"0"
operator=STRING|"5"
type=STRING|"1"
value1=STRING|"{diff}"
value2=STRING|"1"
[Actions\Action9]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action9\Params]
message=STRING|"{filename}; {filetime}; {diff}"
type=STRING|"3"
Save the task into a file and use menu
Task -> Import in order to import it into RoboTask.
Just let me know if you need some comments or explanation for this task.
Re: FTP File Search?
Posted: Mon Aug 12, 2013 8:56 pm
by acepm2
Oleg,
I'm sorry. I'm lost. I installed the basic and entered the code as you stated but I don't see anything. I need this to "download" all the files that would have been uploaded within the last 24 hours.
Can you shed some light on this for me please?
Thank you!
Thom
Re: FTP File Search?
Posted: Tue Aug 13, 2013 9:14 am
by Oleg
Use "
SSL FTP download" action to download a file
See corrected example, step #10. Now the task downloads necessary files into
temporary folder
Pay attention that this is an example only. In any case You should adapt the task for your purposes.
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1663346572
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task287"
Hide=INTEGER|0
ID=INTEGER|1525567110
LogOnAsUser=INTEGER|1
Name=STRING|"Date filter on FTP"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action1\Params]
message=STRING|"******** begin ***************"
type=STRING|"3"
[Actions\Action10]
ActionID=STRING|"A_SSLFTP_DOWNLOAD"
Enabled=INTEGER|-1
Name=STRING|"SSL FTP Download"
Params=FOLDER
[Actions\Action10\Params]
file=STRING|"{filename}"
folder=STRING|"{TEMPDIR}"
ifexists=STRING|"1"
[Actions\Action11]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action12]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action13]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action13\Params]
message=STRING|"******** end ***************"
type=STRING|"3"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FILENAME"" with value """""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FILENAME"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FILETIME"" with value """""
Params=FOLDER
[Actions\Action3\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FILETIME"
[Actions\Action4]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""DIFF"" with value """""
Params=FOLDER
[Actions\Action4\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"DIFF"
[Actions\Action5]
ActionID=STRING|"A_SSLFTP_LOGON"
Enabled=INTEGER|-1
Name=STRING|"SSL FTP Log On"
Params=FOLDER
[Actions\Action5\Params]
anonymous=STRING|"1"
host=STRING|"localhost"
passive=STRING|"1"
password=STRING|"42310383162884337286400984055142142"
port=STRING|"21"
proxypassword=STRING|"2540124941259612545326480"
proxytype=STRING|"3"
tlsmode=STRING|"0"
useproxy=STRING|"0"
username=STRING|"anonymous"
usessl2=STRING|"0"
usessl3=STRING|"0"
usestls=STRING|"1"
[Actions\Action6]
ActionID=STRING|"A_SSLFTP_FILELOOP"
Enabled=INTEGER|-1
Name=STRING|"SSL FTP File Loop"
Params=FOLDER
[Actions\Action6\Params]
filenameonly=STRING|"0"
folder=STRING|"*.*"
kind=STRING|"0"
sizesave=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"1"
varname=STRING|"FILENAME"
vartime=STRING|"FILETIME"
[Actions\Action7]
ActionID=STRING|"BASIC_EVALUATE"
Enabled=INTEGER|-1
Name=STRING|"Evaluate"
Params=FOLDER
[Actions\Action7\Params]
expression=STRING|"datediff(""d"", cdate(""{fileTime}""), now)"
variable=STRING|"DIFF"
[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action8\Params]
case=STRING|"0"
operator=STRING|"5"
type=STRING|"1"
value1=STRING|"{diff}"
value2=STRING|"1"
[Actions\Action9]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action9\Params]
message=STRING|"Download {filename}; File time {filetime}; Age {diff} days"
type=STRING|"3"