Wget
我可以讓 wget -x 下載文件夾結構但不創建域目錄嗎?
我目前正在這樣做:
wget -i download.txt -x
它創建一個根目錄
example.org/
。我想做的只是創建子目錄。有沒有辦法強迫 wget 做我想做的事?
根據手冊頁,參數
-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