Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
server-administration:wget-recursive-ftp [2010-11-08 10:55:02]
garrett.plasky Approved
server-administration:wget-recursive-ftp [2011-07-01 12:21:10] (current)
garrett.plasky Approved
Line 8: Line 8:
 If all of these apply to you, then a recursive wget via FTP is probably your best bet. On the surface recursive wget is quite simple: If all of these apply to you, then a recursive wget via FTP is probably your best bet. On the surface recursive wget is quite simple:
  
-<code console>wget -r ftp://​user:​pass@host.com/​path/​to/​web/​content/</​code>+<sxh shell>wget -r ftp://​user:​pass@host.com/​path/​to/​web/​content/</​sxh>
  
 The problem here is two-fold. If you simply run that command as given assuming the data used above, wget will download data to <​c>/​host.com/​path/​to/​web/​content/</​c>​. It's easy enough to move this content after being copied to the correct location, but we'd rather do it all in one step! So assuming you have switched the the directory where you want the files copied (i.e. public_html),​ the following command will perform the download and remove the directory appending functionality:​ The problem here is two-fold. If you simply run that command as given assuming the data used above, wget will download data to <​c>/​host.com/​path/​to/​web/​content/</​c>​. It's easy enough to move this content after being copied to the correct location, but we'd rather do it all in one step! So assuming you have switched the the directory where you want the files copied (i.e. public_html),​ the following command will perform the download and remove the directory appending functionality:​
  
-<code console>wget -r -nH --cut-dirs=4 ftp://​user:​pass@host.com/​path/​to/​web/​content/</​code>+<sxh shell>wget -r -nH --cut-dirs=4 ftp://​user:​pass@host.com/​path/​to/​web/​content/</​sxh>
  
 In the above example, <​c>​--cut-dirs</​c>​ was set to 4 because we are transversing down 4 directories to get the source data(<​c>/​path/​to/​web/​content/</​c>​),​ so be sure to modify that number based on your particular case. The <​c>​-nH</​c>​ option specifies to not include the host portion of the wget URL in the path as well. In the above example, <​c>​--cut-dirs</​c>​ was set to 4 because we are transversing down 4 directories to get the source data(<​c>/​path/​to/​web/​content/</​c>​),​ so be sure to modify that number based on your particular case. The <​c>​-nH</​c>​ option specifies to not include the host portion of the wget URL in the path as well.