colsatech
asked on
FTP Batch File logging
I am creating a batch to load files onto an FTP site. I want to be able to log the batch file's activity and find out if any of the put commands fail.
Here is my simple .bat file script .
ftp -s:c:\ftpmacro.txt www.myftp.com
What do I need to add to this .bat file to enable a log each time it's run? Or do I modify the actual ftpmacro.txt file that is being called from the .bat file?
Thanks for your help!
Here is my simple .bat file script .
ftp -s:c:\ftpmacro.txt www.myftp.com
What do I need to add to this .bat file to enable a log each time it's run? Or do I modify the actual ftpmacro.txt file that is being called from the .bat file?
Thanks for your help!
ASKER
Here is my .bat file now...
ftp -s:c:\ftpmacro.txt www.myftp.com
ftpmacro.Bat > ftp.log 2>&1
It displays after the quit command never closes the .bat file when it's done running. It creates the log file and I can view the log file but the log file seems to be on a loop. It finishes logging and then starts all over again. The log file gets up to about 40KB in size then goes back to 1KB and starts all over again until I manually close the dos window.
ftp -s:c:\ftpmacro.txt www.myftp.com
ftpmacro.Bat > ftp.log 2>&1
It displays after the quit command never closes the .bat file when it's done running. It creates the log file and I can view the log file but the log file seems to be on a loop. It finishes logging and then starts all over again. The log file gets up to about 40KB in size then goes back to 1KB and starts all over again until I manually close the dos window.
Ok, I'm confused.
Your batch file looks like this:
-------------------------- -
ftp -s:c:\ftpmacro.txt www.myftp.com
ftpmacro.Bat > ftp.log 2>&1
-------------------------- -
Or like this:
-------------------------- -
ftp -s:c:\ftpmacro.txt www.myftp.com
-------------------------- -
Your batch file looks like this:
--------------------------
ftp -s:c:\ftpmacro.txt www.myftp.com
ftpmacro.Bat > ftp.log 2>&1
--------------------------
Or like this:
--------------------------
ftp -s:c:\ftpmacro.txt www.myftp.com
--------------------------
ASKER
After your post, I've changed it from:
ftp -s:c:\ftpmacro.txt www.myftp.com
to
ftp -s:c:\ftpmacro.txt www.myftp.com
ftpmacro.Bat > ftp.log 2>&1
If I understod your instruction correctly.
ftp -s:c:\ftpmacro.txt www.myftp.com
to
ftp -s:c:\ftpmacro.txt www.myftp.com
ftpmacro.Bat > ftp.log 2>&1
If I understod your instruction correctly.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your help!
For example:
MySimple.Bat >> ftp.log 2>>&1
(The above appends to the log file every time. Below will overwrite the log file every time).
MySimple.Bat > ftp.log 2>&1