Automate SFTP Script to download and delete the files after the download from the folder

Advertisement

Gazy007
Joined:
Posts:
3

Automate SFTP Script to download and delete the files after the download from the folder

Hi,

I have never scripted anything.
I have been trying or compiling a script to download files and delete the files after the download and send email if download fail.

Has anyone got ready something like this?

Reply with quote

Advertisement

Gazy007
Joined:
Posts:
3

Struggling to get this script

I have tried to script myself.
I could synchronize the files but I want to download the files and delete after the download from the folder.
Could someone please check why I am getting error.
I am trying to download all the files from download folder and delete after the download.
Resources can be found here – https://winscp.net/eng/docs/scripting
option batch abort
option confirm off
open sftp://admin:password123@myhost.com -hostkey="ssh-rsa 1024 NT733Kz444I4FmYVaVaG6tP9Tug8bU5l4tb+Ug1K168o="
 
get local C:\Temp\Target /folder/message/download -delete
exit

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,587
Location:
Prague, Czechia

Re: Struggling to get this script

There's nothing like get local. It's only get.
And you have the paths in a wrong order. It's:
get remote local
You are also probably missing slashes (and file mask) after the paths.
Please check the documentation:
https://winscp.net/eng/docs/scriptcommand_get
Or have WinSCP GUI generate the script for you.
https://winscp.net/eng/docs/guide_automation#generating

Reply with quote

Gazy007
Joined:
Posts:
3

Where is the transfer setting in WinSCP? The only time I could see Transfer settings when I am trying to connect. It only shows me the script to connect but no other options. I have attached a screenshot.

Capture.PNG

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum