Topic "Delete multiple files from FTP Server after downloading and processing."

Author Message
dbWizard
[View user's profile]

Joined: 2016-05-27
Posts: 7
I am currently running a script which downloads files once a day from a remote FTP server. After performing the download, and manipulating the data, I want to make another trip back to the server and delete only the files that I previously downloaded. I cannot simply do a:

rm *.xml

because files are continuously written to the ftp server at somewhat random times, so one or more records which I have not previously downloaded may appear on the FTP server between the time I finish the download and am ready to delete the files. I'm currently using a script that looks something like:

open ftpes://UserId:Pasword@URL// -Explicit
# Change the remote directory
cd /XML/Test/Out/
rm 0000013261_ABC_CORP_4154795_20160608-083436-089.xml
rm 0000013261_ABC_CORP_4154886_20160608-083548-112.xml
Exit

But that is not working, and on occasion, there may be more than 1000 records. How do I change that script to delete multiple files at a time?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
See https://winscp.net/eng/docs/faq_delete_synchronized_files
dbWizard
[View user's profile]

Joined: 2016-05-27
Posts: 7
"If you do not want to use .NET assembly: Perform the synchronization using synchronize command. Make sure the script generates XML log file. You can then parse the log file to enumerate files that got successfully transferred, and use the list, to generate script to delete the source copies. "

1. I do not want to use the .Net assembly, I am using VB Script
2. I don't want to "synchronize" and delete because I have multiple sites performing downloads at different times
3. I have a log file and am able to parse the file, but the command syntax I provided above to remove multiple files from the FTP server does not work.
dbWizard
[View user's profile]

Joined: 2016-05-27
Posts: 7
Issue closed.

It had to do with the command line that I was creating to run the script.
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