Delete remote files, but not remote directories

Advertisement

oced
Joined:
Posts:
2

Delete remote files, but not remote directories

Greetings:

First, I'd like to say what a great program winscp is.

I've been tasked with automating the downloading of files from a remote server using a script. My requirements are:

    1. Download all files and directories from the remote host
    2. After downloading the files, I have to delete the remote files but NOT the remote directories.
    3. I won't know ahead of time the names of the files or directories so I can't put those into my script.
    4. My remote user id is a virtual user so I cannot use SSH to login after downloading and use standard Unix commands to delete the remote files.

I've been able to recursively download my test files and directories with no problem at all. When I add the -delete option to get, it deletes all of the directories and sub-directories too. More deleting than I want. My command is

get -preservetime -delete *.*

Any ideas about how I can delete the remote files but not the remote directories? Thanks.

Reply with quote

Advertisement

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

Re: Delete remote files, but not remote directories

Do you ant to delete a contents of the directories? I.e. to keep just directory structure?
_________________
Martin Prikryl

Reply with quote

oced
Joined:
Posts:
2

Re: Delete remote files, but not remote directories

martin wrote:

Do you ant to delete a contents of the directories? I.e. to keep just directory structure?

Yes. That's it exactly: keep just the remote server's directory structure after I've downloaded the files.

Thanks.

Reply with quote

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

Re: Delete remote files, but not remote directories

I'm afraid there's no simple solution for this using WinSCP.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum