Automating Download from SFTP remote site

Advertisement

falcrawl
Joined:
Posts:
4

Automating Download from SFTP remote site

All
New to this but achieving some measure of success.
I am connecting to a sFTP site to download a bunch of files everyday to a new folder created everyday by the date stamp. (Done this with a batch file and schedule it to run everyday)
My script is as follows
option batch abort
option confirm off
open sftp://user:password@site.com -hostkey="ssh-rsa 1024 34:2b:a4:06:c7:40:ea:6c:1e:ae:b7:c2:82:34:db:ef"
get -delete -resume -filemask="/Outbox/*.pdf" "Z:\sub1\sub2\MMDDYYYY\
exit

Question.
How can I get the script to verify the correct folder and download the files to that folder for that day. The next day a new folder is created and the files for that day will be downloaded to the current folder

Thanks

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: Automating Download from SFTP remote site

falcrawl wrote:

Thanks but this did not work.
Well, would your mind giving us more details? Describing what "does not work"? A log file? Anything?

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum