Move (download and delete) files from SFTP server

17,114

I found the answer:

http://winscp.net/eng/docs/scriptcommand_get

-delete      Delete source remote file(s) after transfer.
Share:
17,114

Related videos on Youtube

Zeno
Author by

Zeno

Updated on September 18, 2022

Comments

  • Zeno
    Zeno almost 2 years

    I am using a WinSCP (SFTP) script to move files off a SFTP server. Something like this:

    get *.ecx
    

    But this only "copies" files from remote to local. I need to move files off the server. What server command can I use to move multiple files? mv doesn't seem to work as it looks like both arguments are remote.

    I was not able to determine SFTP server being used:

    winscp> version
    Unknown command 'version'.

    • Zeno
      Zeno over 9 years
      @Ƭᴇcʜιᴇ007 But I'm doing multiple files at once and that isn't connected w/ a verify. What if 1 fails, and 9 succeed on a get? If I delete *.ecx I'll be losing a file.
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 9 years
      There is no generic FTP Move command, it's just get+delete. Your specific FTP server MAY have a custom MOVE command (never sene one that does though), but since you can't figure out which FTP server you're connecting to, it's impossible to say. :) Try "Help" at the FTP command prompt and see if a Server->Client Move command is shown. If not, then you're probably stuck with Get+Delete.
    • Frank Thomas
      Frank Thomas over 9 years
      you can always boot from a linux live CD, and open a file manager window to sshfs://servername/path/to/files, so you can make use of Gnomes file management capabilities. perhaps even use rsync to grab the files, so you can be sure they are verified, etc.