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:

wget -r --level=20 -x -nH --cut-dirs=1 -nv 'ftp://user:password@192.168.1.69/Stuff'

Here's a list of the params I used:

-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'

Hope it helps

1 comment:

  1. Thanks, this was just what I needed for a quick-n-dirty transfer of about 2TB from one QNAP to another... runs fairly quick too, compared to bulkier protocols.

    ReplyDelete