我正在尝试使用以下命令下载文件夹:
wget -m -np -nH ftp://user:[email protected]/FTP/config2all/* -P /home/myuser/
但是下载完成后就下载了
/home/myuser/FTP/confi2all/Rest_of_folders
但是,我只想要目录根目录下的文件config2all
,而不是所有子目录。
有什么办法可以做到这一点吗wget
?
答案1
手册wget
页可以帮助您(man wget
是您的朋友):
--level=depth Set the maximum number of subdirectories that Wget will recurse into to depth. In order to prevent one from accidentally downloading very large websites when using recursion this is limited to a depth of 5 by default, i.e., it will traverse at most 5 directories deep starting from the provided URL. Set -l 0 or -l inf for infinite recursion depth.
答案2
我这样解决
wget -r -np -nH --cut-dirs=2