Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy files to FTP without overwriting 1

Status
Not open for further replies.

abnormalclub

Technical User
Joined
Apr 18, 2001
Messages
2
Location
US
Using batch file from Win98SE PC to access FTP, get, and put files in specified directories. Need command to look first for existing file then skip step or abort if file exists. Not good with FTP commands. Need it as simple as possible and don't have time to write program.
 
Commands would be such that the .bat would look for the existence of a file, and then skip a step.
Each step would be named as a process, thus:

PROCESS1
IF EXIST c:\dirname\filename then PROCESS2
{go get the file via FTP}

PROCESS2
IF EXIST c:\dirname\filename2 then PROCESS3
{go get file #2 via FTP

PROCESS3

etc.
This way, if the file exists, it skips to the next process, if the file does NOT exist, it gets the file. Cheers,
Jim
reboot@pcmech.com
Moderator at Staff at Windows 9x/ME instructor.
Jim's Modems:
 
I'm sorry to be so thick-headed. These commands aren't working in the ftp session that is active. I need to check the Unix server for the existence of a file before sending. Am I wrong in assuming the IF/then's will not work when the ftp session is active?
 
You need a DOS FTP session, and the .bat would have to stop after each step to allow the FTP to catch up.
Put PAUSE after each line.
The IF EXIST lines work in DOS, not with FTP, so that part just checks for the existence of the file. The next line would have to carry the FTP command you want.
Here's a more comprehensive style:

:PROCESS1
IF EXIST c:\dirname\filename then goto PROCESS2
{insert the FTP GET command here}
PAUSE

:PROCESS2
IF EXIST c:\dirname\filename2 then PROCESS3
{insert the FTP GET command here}
PAUSE

:PROCESS3

etc.

Where I've put c:\dirname\filename you will have to change to the FTP pathname first.
Cheers,
Jim
reboot@pcmech.com
Moderator at Staff at Windows 9x/ME instructor.
Jim's Modems:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top