[01] SSH Server Technical Support

For technical or licensing inquiries about Bitvise SSH Server, please open a new support case.

I want command to delete files from SFTP server Aftr download

Please help to create a batch to download files from SFTP server,There should be no files laying on the server after downlaod.

I have batch to download files, and it is workin fine  but it does not clean files from SFTP server at same time.

I tried -delete swtich but it is not working my be not using correctly.

Please help this is urgent.

Friday, September 23, 2011

WinSSHD does not currently contain functionality that would support automatic file deletion after a client downloads a file over SFTP.

It would be possible for you to implement such functionality by either parsing the WinSSHD log files and taking action based on triggers in the log file (such as a completed file download), but that would involve a fair amount of programming.

A better way would be to use an SFTP client that supports the feature you are looking for, or something similar to this feature.

For example, you could use our sftpc command line client that comes with Tunnelier. This is a scriptable command line client that you can execute like this:

sftpc user@host -pw=... -cmd="get FileName.txt; del FileName.txt"

When executed this way, sftpc will connect to the server, download the specified file, and request the server to delete the file. If there is an error during the transfer, the delete command will not execute unless you provide the -ce parameter (continue on error).

If you have multiple files you want to transfer, and you know their file names in advance, you could chain together a number of sftpc transfers, like this:

sftpc user@host -pw=... -cmd="get File1; del File1"
sftpc user@host -pw=... -cmd="get File2; del File2"

This would ensure that each file is deleted only after it has been successfully transferred. If any files aren't successfully transferred, they will be left on the server for a future download.
denis bider Send private email
Friday, September 23, 2011
Hi Denis,

Thanks for sugegsting this.

 i am using WINSCP SFTP client. so is this possible with WINSCP client?. I am using this client as broad way in our production environment. we have lots of script running. But we require this feature with our new project.

thanks for suggesting in advace.


Saturday, September 24, 2011

Please update on this


Sunday, September 25, 2011

it looks like WinSCP does support the command necessary to script a download followed by delete, yes. The commands to do so would be "get" followed by "rm", respectively:

denis bider Send private email
Monday, September 26, 2011
Thanks Denis,

i am allready using the method but the problem with this command is " suppose i am downloading 100 files, after downloing the files RM command will remove those files right.if at the same time some one copies another 100  files in the same directory, it removes those files also.

So, it is not meeting the actual requirement.
Please suggest if any other SFTP supports that.This is our business need.


Tuesday, September 27, 2011

actually, it looks like the WinSCP scripting command "get" supports a "-delete" parameter, which will remove the file after it is transferred. Does this not behave the way you intend?
denis bider Send private email
Wednesday, September 28, 2011
-delete command do not do any action, even after putting -delete switch. my batch is also not executed.

You can try this -delete not work as it is menationed.

Please try it your end and suggest.


Friday, September 30, 2011

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz