wget -xを使用してフォルダ構造をダウンロードできますが、ドメインディレクトリを作成できませんか?

wget -xを使用してフォルダ構造をダウンロードできますが、ドメインディレクトリを作成できませんか?

私は現在これをやっています:

wget -i download.txt -x

ルートディレクトリを作成しますexample.org/。私が望むのは、サブディレクトリを作成することだけです。

wgetに私が欲しいものを強制的に実行させる方法はありますか?

ベストアンサー1

マニュアルページによると、このパラメータは-nH要件を満たす必要があります。

   Directory Options
   -nd
   --no-directories
       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).

   -x
   --force-directories
       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
       fly.srk.fer.hr/robots.txt.

   -nH
   --no-host-directories
       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あなたの例で使用されているパラメータが実際に必要かどうかはわかりません。

私の視点で説明した内容を達成するには、以下を実行するだけで十分です。

wget -xnH download.txt

おすすめ記事