|
Answer» HI,
I am trying to create a BATCH script to ftp some files to a remote server. I have a variable in my script CALLED FILETOFTP and call my ftpScript with:
ftp -i -s:FTPSCRIPT.cmd
in FTPSCRIPT.cmd is the following: open 1.1.1.1.1 user password put %FILETOFTP% quit
The FTP script file is unable to pick up the FILETOFTP variable from my calling batch file. Is there any way to make the FTPScript.cmd file use the variable in question?
Here is the full script: REM first rename all files in our DIRECTORY with a .Tab EXTENSION to have a .tfr extension
ren *.tab *.tfr
REM create a file name variable and set to dirList + date + .txt
FOR /f "tokens=*" %%a in ('date /t') do set date=%%a SET FIRSTFILENAME=dirList SET SECONDFILENAME=%FIRSTFILENAME%%date:~4,2%%date:~7,2%%date:~10,4% SET THIRDFILENAME=%SECONDFILENAME:~0,15%.txt
echo %THIRDFILENAME%
REM do a directory lising for .TFR files and pipe the results into an output file
dir *.tfr /B >> %THIRDFILENAME%
REM for each file in THIRDFILENAME do an FTP to the remote host
for /F %%X in (%THIRDFILENAME%) do (SET FILETOFTP=%%X goto FTPFILE) pause
:FTPFILE echo %FILETOFTP% ftp -i -s:FTPSCRIPT.cmd
I am using Windows XP as my operating system to do all this.
Any help would be much appreciated,
Thanks
Phil.
|