Re: FTP Transfer

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.

.



Relevant Pages

  • Re: Compiled ocx file reports different sizes
    ... Rem Set Resource Compiler path ... goto checkMIDL ... echo VC_HOME is set incorrectly. ... echo Step 2: Compiling Resource file ...
    (microsoft.public.vc.mfc)
  • Some batch files for applying MS03-026
    ... find all the Win2k systems. ... the patch to the remote system. ... REM * Author: ... Echo Querying the supplied list for Win2k systems. ...
    (microsoft.public.win2000.security)
  • RE: Help for Windows Vista.
    ... just add a username and password to your command. ... Echo Loggin into our company ... REM *** drev w ... Did you run the Script as Administrator? ...
    (microsoft.public.windows.vista.general)
  • Re: FTP Transfer
    ... echo ftppassword>> FtpScr.txt ... echo bin>> FtpScr.txt ... echo prompt>> FtpScr.txt ... REM files to be transferred are. ...
    (microsoft.public.windows.server.scripting)
  • Re: Rename multiple files?
    ... So Microsoft's wildcards won't let you prefix characters before the wildcard position and apparently retains the length of the substring that it parsed out. ... echo Execute: "%0" ... rem - environment variables, especially needed inside for-loops. ...
    (microsoft.public.windowsxp.basics)