Ben Biddington

Whatever it is, it's not about "coding"

Posts Tagged ‘ftp

FTP command line fu

with one comment

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.

Redirection

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
Done.

Tips

  • Don’t forget to add the quit or bye command at the end otherwise your command line’ll hang

References

Advertisements

Written by benbiddington

3 August, 2010 at 13:37

Posted in development

Tagged with , , ,

Pea Green Boat, Automating FTP deployment

leave a comment »

We are using NAnt with an FTP build task

I will combine this with our subversion repository to enable one click deploy. Also may convert Selenium script so we can run that at the same time.

There does not seem to be an official FTP task, however there is the one mentioned above. It does not include delete for some reason which is unforunate. Perhaps we should switch to Ant which does have a fully working delete.

Additional tasks required:

  1. FTP task
  2. NantContrib (Enables Subversion interaction)
Download these and place them in a tasks folder underneath the nant installation directory, and then reference them using the loadtasks element.
We now have a bunch of targets we can run for automated deployment over FTP.
There is more on this on the project wiki page.

Written by benbiddington

18 September, 2008 at 15:26

Posted in development

Tagged with , , , ,