Posts Tagged ‘automation’
The Windows FTP utility can be easily automated, but if you want to record the output from a session it appears you need to do things in a particular way.
It appears this does not work as expected, i.e. you can’t redirect stdout from an interactive ftp session to local file. It creates the file but with nothing in it.
Solution is to run ftp with the -s option which specifies a file containing the full list of commands to be run (including log-in).
> ftp -s:commands.txt > out/result.txt
Where your commands list looks like this example that prints the contents of a directory called phils_lunchbox :
open host_or_ip_address port username Password cd phils_lunchbox ls -l quit
- Don’t forget to add the quit or bye command at the end otherwise your command line’ll hang