Uploading multiple files via batch file

Advertisement

robr
Joined:
Posts:
2
Location:
London

Uploading multiple files via batch file

Guys,

I'm trying to upload six Excel files via a batch file. As far as I can tell the syntax here is just to split the filenames with a space - e.g. ABC.xls XYZ.xls.

When I run a batch file (which pipes the results to the log file using the log= switch) I can see it's listing the files but then only counting 5 files instead of 6.

The last file in the string it seems to deal with individually, then the remaining files it uploads one by one, looking at the FTP site it's then ONLY uploaded the last file, not the first five.

This is my version details: WinSCP Version 4.3.5 (Build 1463) (OS 6.0.6002 Service Pack 2)

Below is a cut of the log file:

> 2012-06-20 12:22:44.345 Script: put 1.xls 2.xls 3.xls 4.xls 5.xls 6.xls
. 2012-06-20 12:22:44.382 Copying 5 files/directories to remote directory "/ftproot/aaa/bbb"
. 2012-06-20 12:22:44.382 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: 6.xls
. 2012-06-20 12:22:44.382 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2012-06-20 12:22:44.382 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2012-06-20 12:22:44.390 File: "1.xls"
. 2012-06-20 12:22:44.397 Copying "1.xls" to remote directory started.
. 2012-06-20 12:22:44.397 Binary transfer mode selected.
. 2012-06-20 12:22:44.397 Starting upload of 1.xls
> 2012-06-20 12:22:44.397 CWD /ftproot/aaa/bbb/
< 2012-06-20 12:22:44.401 250 CWD command successful.
> 2012-06-20 12:22:44.401 PWD

The part for 1.xls is then repeated for 2-5.

The batch file looks like this:

@echo off
set name="test"
set localdir="\\server\folder\"
set filename=1.xls 2.xls 3.xls 4.xls 5.xls 6.xls
set remotedir="/ftproot/aaa/bbb"

echo open ftp://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> ftpcmd.dat
echo option batch abort>>ftpcmd.dat
echo option confirm off>>ftpcmd.dat
echo cd %remotedir% >>ftpcmd.dat
echo lcd %localdir% >>ftpcmd.dat
echo bin>> ftpcmd.dat
echo put %filename% >> ftpcmd.dat
echo exit>> ftpcmd.dat
"c:\Program Files (x86)\WinSCP\WinSCP.com" /script=ftpcmd.dat /log=upload.log

Am I calling the six files incorrectly? It seems really odd that it's uploading the last one only and not the ones before when the log would suggest it has uploaded them?!

Any help much appreciated, I'm going a little mad here! (Oh and I'm new to all of this!)

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum