I'm currently doing this:

wget -i download.txt -x

It creates a root directory example.org/. What I'd like to do is only create subdirectories.

Is there a way to compel wget into doing what I'd like?

1 Answer 1


According to the man page the parameter -nH should do what you are looking for:

   Directory Options
       Do not create a hierarchy of directories when retrieving recursively.  With this option turned on, all
       files will get saved to the current directory, without clobbering (if a name shows up more than once,
       the filenames will get extensions .n).

       The opposite of -nd---create a hierarchy of directories, even if one would not have been created
       otherwise.  E.g. wget -x http://fly.srk.fer.hr/robots.txt will save the downloaded file to

       Disable generation of host-prefixed directories.  By default, invoking Wget with -r
       http://fly.srk.fer.hr/ will create a structure of directories beginning with fly.srk.fer.hr/.  This
       option disables such behavior.

I'm not sure that you really need the -i param used in your example.

From my point of view, to achieve what you described is enough to run:

wget -xnH download.txt
  • Oh I thought I tried that but it works now. Thanks!
    – Kit Sunde
    Oct 9, 2015 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .