Delete File on Schedule

Advertisement

jgn
Guest

Delete File on Schedule

I'm new to this program and how to create/run scripts. Everything I've found for deleting a file is linked to an upload, download, or a sync. I don't have a triggering event, I just want to delete all files in a folder on my FTP everyday at 2pm. How would I go about doing that?

Thanks so much!!!

Reply with quote

Advertisement

jgn
Guest

Re: Delete File on Schedule

So would this be the correct script then?
# Connect to SFTP server using a password
open sftp://ipaddresswithuser:2222/ -passive=on -hostkey="password"
 
# Delete file
rm ums_update.txt
 
# Exit WinSCP
exit
The sftp is my ip and then the port... if I wanted to go into a specific folder would I just add that to the end of that link after the port? so :2222/folder/?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
35,438
Location:
Prague, Czechia

Re: Delete File on Schedule

jgn wrote:

if I wanted to go into a specific folder would I just add that to the end of that link after the port? so :2222/folder/?
That works. But more idiomatic approach is to use cd /folder command.
https://winscp.net/eng/docs/scriptcommand_cd

Reply with quote

Advertisement

You can post new topics in this forum