Re: FTP Transfer
- From: "Jorge Silva" <jorgesilva_pt@xxxxxxxxxxx>
- Date: Fri, 25 Jul 2008 14:34:15 +0100
basically what i'm looking for is something like this
ftpusername
ftppassword
bin
prompt
lcd "C:\Srv\Output"
put FileNAme000
IF FILE TRANSFER = SUCCESS THEN !move FileNAme000 ..\Backup\Output
But the command isn't this what should be in this case?
--
I hope that the information above helps you.
Have a Nice day.
Jorge Silva
MCSE, MVP Directory Services
"Jorge Silva" <jorgesilva_pt@xxxxxxxxxxx> wrote in message news:OdtcAll7IHA.3976@xxxxxxxxxxxxxxxxxxxxxxx
Hi McKirahan thank you for your response,
This is a batch file and it runs every 5 minutes, the problem is if the connection fails for some reason the move is still performed and it shouldn't be, if for some reason the connection fails the batch should retry in the next 5 minutes and so on, so the objective is, if the file was trasnferred successfully then move, otherwise cancel the move operation. Heres the Bach File:
<---------------------------------------------------->
@ECHO OFF
IF EXIST "c:\batch\FileList.txt" goto CancelOperation
REM Change Directory where the files to be transferred are.
cd "C:\Srv\Output"
REM Copy the name of the files in the directory
REM "C:\Srv\Output" to the FileList.txt
dir /b > "c:\batch\FileList.txt"
REM Move to the directory where the batch file and FileList.txt are
cd "c:\batch"
REM Load information into the FtpScr.txt that will be used by
REM the command "ftp -s:FtpScr.txt 000.000.000.000" at the end of this batch file.
echo ftpusername> FtpScr.txt
echo ftppassword>> FtpScr.txt
echo bin>> FtpScr.txt
echo prompt>> FtpScr.txt
REM lcd to change to the directory where the
REM files to be transferred are.
echo lcd "C:\Srv\Output">> FtpScr.txt
REM Where it loads the information from the files from the
REM FileList.txt to the FtpScr.txt adding the !put and the !move
For /f "tokens=1" %%a in (c:\batch\FileList.txt) do (
If /i "%%a" NEQ "All" (
echo put %%a>> FtpScr.txt
echo !move %%a ..\Backup\Output>> FtpScr.txt
)
)
echo quit>> FtpScr.txt
REM Inserts the date and time into FtpLog.txt
echo. |date /T>> FtpLog.txt
echo. |time /T>> FtpLog.txt
REM Begins the transfer and logs the information in the FtpLog.txt
ftp -s:FtpScr.txt 000.000.000.000>> FtpLog.txt
del c:\batch\FileList.txt
:CancelOperation
<---------------------------------------------------->
The FtpScr.txt looks like
<---------------------------------------------------->
ftpusername
ftppassword
bin
prompt
lcd "C:\Srv\Output"
put FileNAme000
!move FileNAme000 ..\Backup\Output
put FileNAme001
!move FileNAme001 ..\Backup\Output
put FileNAme002
!move FileNAme002 ..\Backup\Output
quit
<---------------->
<---------------------------------------------------->
Thank you again.
.
- Follow-Ups:
- Re: FTP Transfer
- From: Tom Lavedas
- Re: FTP Transfer
- References:
- FTP Transfer
- From: Jorge Silva
- Re: FTP Transfer
- From: McKirahan
- Re: FTP Transfer
- From: Jorge Silva
- FTP Transfer
- Prev by Date: Re: FTP Transfer
- Next by Date: NTBackup log files - HOWTO rename them
- Previous by thread: Re: FTP Transfer
- Next by thread: Re: FTP Transfer
- Index(es):
Relevant Pages
|