Jun 06, 2012 Tags: Linux, Howto
Use wget to copy an installation if one machine offers FTP only.
Let’s say you want to move an installation to your new server where you have shell access but on the other server you can only do FTP. What can you do?
Here is one solution: The Linux/Gnu tool wget is probably available. And wget does FTP just fine.
Here is an example:
$ cd ~
$ mkdir incoming
$ cd incoming
$ wget -r -l0 -c -nH -N -nv ftp://user:password@www.sourcedomain.tld/html/*
In this example you go to your home directory and create a subfolder “incoming”, you then go to “incoming” and issue the “wget” command. It will fetch all files from the source server - in this case starting in the FTP folder /html.
Tip: If there is an @
character in your username use %40
instead.
FTP user names frequently look like user%40domain.com@domain.com
.
What they mean:
-r | recursive |
-l | l0 = no recursion limit |
-c | continue. Means: retry if there are connection problems. |
-nH | don’t create an extra home dir |
-N | Use “timestamping”. This means, only updated files are fetched if you run the command again. |
-nv | Don’t be really verbose. Just tell what’s necessary. |
This wget method isn’t as fast and powerful as rsync but may come in handy from time to time and can definitely be useful.
Have fun!