Post a reply

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: Help with scheduling uploads with wildcards in the file names

Does the first upload work?

The second upload never happens as you exit the script.
Remove the first exit (and the second open).

If this does not help, please attach a full session log file showing the problem (using the latest version of WinSCP).

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.
xtraozon

Help with scheduling uploads with wildcards in the file names

Hello.

I am new to WinSCP but i hope it will be the tool i need for a task i have.

I need a script to automatically connect to a ftp server each night and upload CSV files to two folders.

The files will be named something like Fakturor_20191129.csv and betalningar_20191129.csv.

The files starting with fakturor must be uploaded to a folder called reminder, and betalningar to a folder called payment.

I have written the following script and created a task in task scheduler, but it is not working so i am obviously doing something wrong.

I would also like the script to download all the files in another folder on the server, delete them, and then download them to E:\Root\Apps\Winbas\foobar\foobar.

Any help would be appreciated.

open ftp://user:password5@ftp.server.com/


cd /reminder

put E:\Root\Apps\Winbas\foobar\Fakturor\fakturor*.csv

exit

open ftp://user:password5@ftp.server.com/

cd /payment

put E:\Root\Apps\Winbas\Wbserv\foobar\Fakturor\betalningar*.csv


exit

# Kör skriptet med ett kommando som:
# "C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\ftp\WinSCP.log" /ini=nul /script="C:\ftp\sync.txt"