SFTP wilecards

Discuss RoboTask here
Post Reply
bford@vpi-i.com
Posts: 3
Joined: Thu Aug 09, 2018 3:56 pm

SFTP wilecards

Post by bford@vpi-i.com »

Hi,

I am connecting to a SFTP site and want to downoad selected files but i can not figure out the wilecards to use

The task i have setup is
1 SFTP Open
2 SFTP Download
3, SFTP Logoff

on action 2 i do not know what to put in the "Remote File or Folder:" box

can someone please advise

Brian
Oleg
Site Admin
Posts: 3010
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: SFTP wilecards

Post by Oleg »

You have to specify file name or folder name explicitly without masks.
You can use variables, but the result should contain the name of file or folder.
If you specify file only - the action downloads only specify file
If you specify folder name - the action downloads whole folder with all files

In order to download files by mask you have to use SFTP File loop action and download all files one-by-one
Look at my example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Next you can view it in 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|1897123812
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task234"
Hide=INTEGER|0
ID=INTEGER|-2039501168
LogOnAsUser=INTEGER|1
Name=STRING|"download files by mask"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=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_SFTP_LOGON"
Enabled=INTEGER|-1
Name=STRING|"SFTP Open (username@MyServer)"
Params=FOLDER

[Actions\Action1\Params]
host=STRING|"MyServer"
password=STRING|"8300183858849008361683093"
passwordmode=STRING|"0"
port=STRING|"22"
usecertificate=STRING|"0"
username=STRING|"username"

[Actions\Action2]
ActionID=STRING|"A_SFTP_DIR"
Enabled=INTEGER|-1
Name=STRING|"SFTP File loop"
Params=FOLDER

[Actions\Action2\Params]
createmode=STRING|"1"
date1=STRING|"18991230"
date2=STRING|"18991230"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
filenameonly=STRING|"0"
folder=STRING|"./test/*.*"
kind=STRING|"0"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
sizesave=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subfolders=STRING|"0"
timesave=STRING|"0"
varname=STRING|"FILENAME"

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

[Actions\Action3\Params]
message=STRING|"Downloading {filename} "
type=STRING|"3"

[Actions\Action4]
ActionID=STRING|"A_SFTP_GET"
Enabled=INTEGER|-1
Name=STRING|"SFTP Download ({FileName})"
Params=FOLDER

[Actions\Action4\Params]
file=STRING|"{FileName}"
folder=STRING|"{TEMPDIR}"
ifexists=STRING|"1"
recursive=STRING|"0"

[Actions\Action5]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg Yershov
bford@vpi-i.com
Posts: 3
Joined: Thu Aug 09, 2018 3:56 pm

Re: SFTP wilecards

Post by bford@vpi-i.com »

Hi,

Many thanks for the reply, i have one more silly question, how do i know thename of the folder, when i connect vit filezilla it takes me straight to the folder i have access to. i do not know the path or folder name

regards

Brian
Oleg
Site Admin
Posts: 3010
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: SFTP wilecards

Post by Oleg »

you should know something:
- File mask
- some base folder or folders mask

you can't select folder and files interactively. You should know some parameters of files and folders.
enumerate all files from ROOT folder is a very bad idea.

BTW: sFTP File loop can make the loop by folders too.
if you don't know the name you have to use the loop to enumerate them by mask
Oleg Yershov
Post Reply