Stuart Hurley wrote: > Hi > > I'm using wget for backup for a web sites. I use --recursive > --no-host-directories to scan through the folders, but wget keeps > creating the remote parent folder structure. On the web server the > site starts at /public_html/home/store/special. This path is recreated > in my backup folder eg /backup/public_html/home/store/special/.., I > then have to use mv and rmdir on the backup machine to move the files > up a few parent folders and get rid of the original directories.
Why do you have to do that?
> I am > checking with some Linux experts I haven't missed anything obvious.
I think the obvious answer is: fix the loopy server.
> Is > there a switch in the wget that does not create remote parent folders > on the local machine?
But you seem to want dirs, just not the useless ones. :)
actually I think there is a way to do this:
--cut-dirs=number Ignore number directory components. This is useful for getting a fine-grained control over the directory where recursive retrieval will be saved.
Take, for example, the directory at ftp://ftp.xemacs.org/pub/xemacs/. If you retrieve it with -r, it will be saved locally under ftp.xemacs.org/pub/xemacs/. While the -nH option can remove the ftp.xemacs.org/ part, you are still stuck with pub/xemacs. This is where --cut-dirs comes in handy; it makes Wget not ‘‘see’’ number remote directory components. Here are several examples of how --cut-dirs option works.
No options -> ftp.xemacs.org/pub/xemacs/ -nH -> pub/xemacs/ -nH --cut-dirs=1 -> xemacs/ -nH --cut-dirs=2 -> .
--cut-dirs=1 -> ftp.xemacs.org/xemacs/ ...
If you just want to get rid of the directory structure, this option is similar to a combination of -nd and -P. However, unlike -nd, --cut-dirs does not lose with subdirectories---for instance, with -nH --cut-dirs=1, a beta/ subdirectory will be placed to xemacs/beta, as one would expect.
Carl K
©2006 Carl Karsten |