Topic "Delete remote files, but not remote directories"

Author Message
oced
[View user's profile]

Joined: 2009-09-16
Posts: 2
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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Do you ant to delete a contents of the directories? I.e. to keep just directory structure?
_________________
Martin Prikryl
oced
[View user's profile]

Joined: 2009-09-16
Posts: 2
prikryl 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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
I'm afraid there's no simple solution for this using WinSCP.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License