Thursday, 12 January 2012

Quick and dirty recursive FTP

I just brought a new QNAP NAS (TS-459 Pro II) - which is pretty cool, but I needed a way of getting all my files off the old NAS (which only supported FTP). QNAP doesn't come with lftp or any other ftp package that could do recursive gets so I started looking at scripting. I found a couple out there but all written in bash or ksh, both of which are not installed on the QNAP. These didn't work in plain old sh and I didn't fancy debugging them.

In the end, I used wget from a shell on the QNAP to copy the files from my old NAS' ftp server:

-r: recursive download
--level: depth to go down to (wget has a maximum of 5 if this is not given)
-x: create folders
-nv: non-verbose, but not as quiet as '-q'
-nH: Don't prefix the downloaded folder structure with the host name (in my case, '192.168.1.69')
--cut-dirs=1: Don't prefix the downloaded folder structure with '/Stuff'