Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Files and folders are removed from remote directory when I use get -delete

Your script looks good. It should not delete the folder. Isn't it server's behaviour that it deletes empty folders automatically?

If you do not think so and still believe it's WinSCP that is deleting the folder, please attach a full session log file.

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
PK

Files and folders are removed from remote directory when I use get -delete

Hi,
I am having trouble getting files and deleting them from the server. When I do so, If the server directories are empty, they are being deleted as well. I was using a dummy file to prevent the directory being deleted, but the company has now put in place a rule to delete all files over 30 days old, so I can no longer use dummy files.
The command I am using is:
"lcd ""C:\Target\Dir\Temp_Download""" ^
"get ""/RootDir/*"" -delete -resume -preservetime -filemask=*.dat ""C:\Target\Dir\Temp_Download\""" ^

I am using a batch file to run WinSCP.

Can anyone please help me,
Thank you
Peter