如何使此 rsync 命令非递归?

gor*_*vix 3 rsync recursive

rsync -avi --delete --modify-window=1 --no-perms --no-o --no-g
    ~/Documents/Stuff/ /media/user/PC/Stuff;;
Run Code Online (Sandbox Code Playgroud)

即不从源目录复制子目录?

Ech*_*444 7

摘自man rsync

    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
Run Code Online (Sandbox Code Playgroud)

-a 意味着-r 你可以:

 remove `-a --no-perms --no-o --no-g ` and replace by `-ltD`
Run Code Online (Sandbox Code Playgroud)

或者

 add `--no-recursive`       
Run Code Online (Sandbox Code Playgroud)

--delete增加更多的复杂性,从man rsync

--删除`

Prior to rsync 2.6.7, this option would have no effect unless --recursive was enabled.  
Beginning with 2.6.7, deletions will also occur when --dirs (-d) is  enabled,  but  only  for  directories whose contents are being copied.
Run Code Online (Sandbox Code Playgroud)

所以你必须使用--dirs


Fre*_*ddy 5

您可以--exclude='*/'在 rsync 选项中添加选项以防止目录同步。