Smiling Human Smiling Human Technical Services

Work with a friendly, courteous, dependable, capable smiling human. Your personal geek.

Smiling Human Technical Services header image 2

Moving Your Site with Wget

May 18th, 2007 · No Comments

I recently needed to move a site from my old host to new. I set up my shell access at the new location so that I could use Wget to move the site and take advantage of my host’s fat pipes. I looked around and found tips in various locations on how to use Wget, yet nothing worked as I needed. The code below is what ultimately worked for me after some trial and error.

Wget -rc -nH --cut-dirs=1 --level=20 ftp://your-username:your-password@ftp-address/your-subdirectory/

-r recursive to retrieve all files and subdirectories

-c Continue getting a partially-downloaded file.

-nH No host directories - by default, Wget was replicating the remote host as part of the directory structure, and this option got rid of that for me.

--level=20 By default, recursion only goes 5 levels deep, if you need more, this allows you to customize it. I knew I needed more than five, but less than 20. It was easier to set it for much more than I needed than to try to hunt down the exact number. So… call me lazy.

--cut-dirs=1 this was the last little bugger that helped me along. It helps you control the location of your recursive results, by trimming the topmost directory.

For more detailed information and other options, check out the Wget manual at GNU.

Tags: Uncategorized