Location: Keene NH
Posted: 2012-11-30 18:08
I have a script which connects to a remote server, then uploads files daily. However, the files are not always created each day, and I need the batch file to continue if the file doesn't exist. Right now, I am getting the following error:
File or folder 'y:\file1.xls' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
Press any key to continue...
Here is the code:
net use b: "Location 1"
net use x: "Location 2"
net use y: "Location 3"
echo option batch abort> b:\ftpcmd.dat
echo option confirm off>> b:\ftpcmd.dat
echo open username:email@example.com:22>> b:\ftpcmd.dat
echo put y:\file1.xls /folder/>> b:\ftpcmd.dat
echo put x:\file2.xml /folder/>> b:\ftpcmd.dat
echo put x:\file3.xml /folder/>> b:\ftpcmd.dat
echo put x:\file4.xml /folder/>> b:\ftpcmd.dat
echo exit>> b:\ftpcmd.dat
cd c:\program files\winscp\
Rem ********* Delete FTP Script File ***********
net use b: /DELETE /y >NUL
net use x: /DELETE /y >NUL
net use y: /DELETE /y >NUL
Any suggestions would be appreciated.
Location: Prague, Czechia
if exist y:\file1.xls echo put y:\file1.xls /folder/>> b:\ftpcmd.dat
You can post new topics in this forum
And it's free!