Task Scheduler - GET and MOVE

Advertisement

whgragso
Joined:
Posts:
1

Task Scheduler - GET and MOVE

I have a script setup to get files from my SFTP and place them on a local folder. Instead of deleting the file after I get the file, I would like to move it to a folder on my SFTP. The get function is working but the mv is not. Any ideas?

open sftp://********************/ -hostkey="ssh-rsa 2048 *******************=" -privatekey="*************************"

cd /upload
lcd C:\TEST

get file-int-*.mp
mv file-int-*.mp /old

exit

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,266
Location:
Prague, Czechia

Re: Task Scheduler - GET and MOVE

It should be mv file-int-*.mp /old/

Though note that your script is not transactionally safe. If a new file appears after get starts, but before mv, it won't be downloaded, but will be moved.
For a translatioanlly safe solution see https://stackoverflow.com/q/48311614/850848

Reply with quote

Advertisement

You can post new topics in this forum