Skip file on error

Advertisement

darthmikeyd
Joined:
Posts:
1
Location:
Keene NH

Skip file on error

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:
@echo off

net use b: "Location 1"
net use x: "Location 2"
net use y: "Location 3"

set m=%DATE:~4,2%
set d=%DATE:~7,2%
set y=%DATE:~-4%
set y2=%DATE:~-2%

echo option batch abort> b:\ftpcmd.dat
echo option confirm off>> b:\ftpcmd.dat
echo open username:password@ftp.address: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\

winscp.com /script=b:\ftpcmd.dat

Rem ********* Delete FTP Script File ***********
del b:\ftpcmd.dat

net use b: /DELETE /y >NUL
net use x: /DELETE /y >NUL
net use y: /DELETE /y >NUL

pause

Any suggestions would be appreciated.

Thanks
Mike

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum