wget: Directory Options

1 
1 2.6 Directory Options
1 =====================
1 
1 ‘-nd’
1 ‘--no-directories’
1      Do not create a hierarchy of directories when retrieving
1      recursively.  With this option turned on, all files will get saved
1      to the current directory, without clobbering (if a name shows up
1      more than once, the filenames will get extensions ‘.n’).
1 
1 ‘-x’
1 ‘--force-directories’
1      The opposite of ‘-nd’—create a hierarchy of directories, even if
1      one would not have been created otherwise.  E.g.  ‘wget -x
1      http://fly.srk.fer.hr/robots.txt’ will save the downloaded file to
1      ‘fly.srk.fer.hr/robots.txt’.
1 
1 ‘-nH’
1 ‘--no-host-directories’
1      Disable generation of host-prefixed directories.  By default,
1      invoking Wget with ‘-r http://fly.srk.fer.hr/’ will create a
1      structure of directories beginning with ‘fly.srk.fer.hr/’.  This
1      option disables such behavior.
1 
1 ‘--protocol-directories’
1      Use the protocol name as a directory component of local file names.
1      For example, with this option, ‘wget -r http://HOST’ will save to
1      ‘http/HOST/...’ rather than just to ‘HOST/...’.
1 
1 ‘--cut-dirs=NUMBER’
1      Ignore NUMBER directory components.  This is useful for getting a
1      fine-grained control over the directory where recursive retrieval
1      will be saved.
1 
1      Take, for example, the directory at
1      ‘ftp://ftp.xemacs.org/pub/xemacs/’.  If you retrieve it with ‘-r’,
1      it will be saved locally under ‘ftp.xemacs.org/pub/xemacs/’.  While
1      the ‘-nH’ option can remove the ‘ftp.xemacs.org/’ part, you are
1      still stuck with ‘pub/xemacs’.  This is where ‘--cut-dirs’ comes in
1      handy; it makes Wget not “see” NUMBER remote directory components.
1      Here are several examples of how ‘--cut-dirs’ option works.
1 
1           No options        -> ftp.xemacs.org/pub/xemacs/
1           -nH               -> pub/xemacs/
1           -nH --cut-dirs=1  -> xemacs/
1           -nH --cut-dirs=2  -> .
1 
1           --cut-dirs=1      -> ftp.xemacs.org/xemacs/
1           ...
1 
1      If you just want to get rid of the directory structure, this option
1      is similar to a combination of ‘-nd’ and ‘-P’.  However, unlike
1      ‘-nd’, ‘--cut-dirs’ does not lose with subdirectories—for instance,
1      with ‘-nH --cut-dirs=1’, a ‘beta/’ subdirectory will be placed to
1      ‘xemacs/beta’, as one would expect.
1 
1 ‘-P PREFIX’
1 ‘--directory-prefix=PREFIX’
1      Set directory prefix to PREFIX.  The “directory prefix” is the
1      directory where all other files and subdirectories will be saved
1      to, i.e.  the top of the retrieval tree.  The default is ‘.’ (the
1      current directory).
1