我使用 rsync v.3.0.4,当我需要移动某些内容时,我将其与 --remove-source-files 一起使用。与 mv 相比,我更喜欢 rsync。
不幸的是,当我使用 --remove-source-files 时,目录保留在源端(如 man 中所述)。一旦移动了所有文件,有没有办法也删除目录?
您始终可以通过以下方式手动删除它们:
find /path/to/directory -depth -type d -print0 \
| xargs --null --no-run-if-empty rmdir --
Run Code Online (Sandbox Code Playgroud)
这只会删除空目录。
| 归档时间: |
|
| 查看次数: |
3546 次 |
| 最近记录: |