Topic "VBScript, Retrieving files and deleting files via ftp"

Author Message
jimmoney@oxfordlife.com
[View user's profile]

Joined: 2015-02-09
Posts: 1
Location: Phoenix
Trying to use synchronize to retrieve unique files from an ftp site, and then delete the file from the remote site. The unique file is retrieved, but not deleted. Also files in a subdirectory are retrieved as well as the directory structure.

Script Code:
option echo on
option batch on
option confirm off
option transfer binary
open sftp://DPS_Oxford:xxxxxxxxx@99.99.999.99 -privatekey=D:\Spool\VBControl\Policy_FTP\DPS_xxxxxx.ppk
cd /OX1000_POLICY_PRINTING_WITH_CERTIFIED_MAILING
synchronize local P:\PolicyAssemblyAnnuity\AnnuityTrackingArchive -filemask="/OX1000_POLICY_PRINTING_WITH_CERTIFIED_MAILING\*.csv" -Delete
close

Command executed:
sCmd = """C:\Program Files\WinSCP\WinSCP.com"" -script=" & sFTPTempFile & " /log=P:\PolicyAssemblyAnnuity\AnnuityTrackingArchive\Script.log"


exit
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25019
Location: Prague, Czechia
The -delete switch of synchronize deletes obsolete files in the target (local in this case) directory. Not downloaded files, that would not be a synchronization. The point of synchronization is to make contents of both directories identical.

If you want to download a file and remove the original, use get -delete *.csv.
See https://winscp.net/eng/docs/scriptcommand_get
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