Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to transfer two text files from my local PC to a directory on my server. I use a command sequence stored in FtpCommand.cmd to perform the commands in ftp, using the following command.

ftp -i -s:c:\Telex\FtpCommands.cmd

The FtpCommand.cmd command sequence is:

open ftp.mysite.it
username
password
cd httpdocs
cd subdomains
cd falbrav
cd httpdocs
cd EXTRA
cd TLX
cd DATA
ASCII
put c:\Telex\dainviare\file1.txt
put c:\Telex\dainviare\file2.dat
quit

Normally everything goes well, but sometimes file2.dat (about 150-200 kb) only has 0Kb size on the destination.

How do I figure out what is failing? How can I figure out what part of the operation is malfunctioning?

share|improve this question
    
You could add a verbose command before the put commands and maybe get a better idea what's happening. Also, are you sure you want to transfer the second file in ascii mode rather than binary? –  martineau Jun 13 '13 at 22:05
    
Tried both binary and ascii mode. I added the verbose command and the debug one, but I need to produce a log file to see all the step goes well. Is it possible? –  Carlo Magno Jun 14 '13 at 8:36
    
You should be able to redirect both stdout and stderr output into a single log file with something like ftp -i -s:c:\Telex\FtpCommands.cmd >>transfer.log 2>&1 –  martineau Jun 14 '13 at 16:22
    
If Windows FTP does not offer enough scripting options, you may want to consider WinSCP, a free utility which has a command mode (as well as a GUI) that can be used for scripting. It also has good logging capabilities. –  martineau Jun 14 '13 at 16:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.