简体   繁体   中英

Recursively delete files from Windows SFTP server

I'm attempting to create a batch file within an SSIS script task that uses psftp.exe . The batch file will connect to a remote SFTP server (running Windows XP) and recursively bring down files. The files (but not their directories) should be deleted once the downloading has been accomplished.

The batch file calls psftp.exe -b script . Within the script file, I can recursively bring down files with this command:

mget -r Share

(Share is the starting folder; the folder structure resembles):

.../Share/Client1
.../Share/Client2

However, I can't figure out how to delete the files that I've brought down. If I could get a recursive move going it would work but it hasn't worked yet. Same with a recursive delete after the 'mget' has been performed.

Does anyone have an answer?

WinSCP can do this with a -delete switch on the get command: www.winscp.net/eng/docs/faq_script_transfer_and_delete

WinSCP works well with SSIS using the Execute Process Task. Scripts are usually not required as you can string commands together using /command

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM