我想通过FTP镜像文件夹,如下所示:

wget --mirror --user=x --password=x ftp://ftp.site.com/folder/subfolder/更深

但我不想创建这样的目录 struct :

ftp.site.com -> folder -> subfolder -> 更深

我只想:

更深

And anything below it to be the resulting structure. It would also be acceptable for the contents of 更深 to wind up in the current directory as long as subdirectories are created for subdirectories of 更深 on the server.

I am aware of the -np option, according to the documentation that just keeps it from following links to parent pages (a non-issue for the binary files I'm mirroring via FTP). I am also aware of the -nd option, but this prevents creating any directory structure at all, even for subdirectories of 更深.

我会考虑备选方案,只要它们是基于命令行的,很容易被用作Ubuntu包,并且很容易像WGET一样自动化.

推荐答案

对于这样的路径:ftp.site.com/a/b/c/d

-nH将所有文件下载到当前目录中的目录a/b/c/d-nH --cut-dirs=3将所有文件下载到当前目录中的目录d.

Linux相关问答推荐

如何将netcdf文件列表中的特定变量添加到不同的文件中?

无法下载Centos 7上的存储库的元数据

Bash:将带有新行的字符串转换为带有逗号、内联的唯一值的字符串

AWK:按第一列匹配两个文件不起作用

如何添加Linux格式的时间输出

bash 更有效的方法来转换奇数日期格式以被 linux 日期识别

在 puppet 中管理 linux 的用户密码

在 64 位 Linux 操作系统上编译 32 位程序导致致命错误

从 shell 将多个 .sql 转储文件导入 mysql 数据库

无法覆盖符号链接 RedHat Linux

如何在 Linux 中创建高分辨率计时器来测量程序性能?

Pthread mutex互斥断言错误

如何删除 Mercurial 存储库

如何获取/使用 LibUUID?

如何使用 bash 在文件中间添加一行文本?

Shell 脚本, echo 消息后在同一行读取

在 Ubuntu 中学习 OpenGL

Anaconda 安装后,conda 命令失败并显示ImportError: no module named conda.cli

如何从 shell 确定当前的 CPU 利用率?

libaio.so.1:无法打开共享对象文件