V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
az22c
V2EX  ›  macOS

[求个指令] 复制文件夹,并“排除”里面嵌套的 node_modules

  •  
  •   az22c · Sep 3, 2021 · 2474 views
    This topic created in 1697 days ago, the information mentioned may be changed or developed.
    其实问题等同于这个问题:(只不过我是 macos 用不了里面介绍的复制的指令和软件)
    https://superuser.com/questions/940804/copy-large-number-of-files-but-exclude-certain-sub-folders-on-windows
    7 replies    2021-09-04 17:18:27 +08:00
    ratazzi
        1
    ratazzi  
       Sep 3, 2021 via iPhone
    rsync 啊
    yzwduck
        2
    yzwduck  
       Sep 3, 2021   ❤️ 1
    * rsync -r --exclude node_modules source target
    * bsdtar -c --exclude node_modules -C source . | bsdtar -x -C target
    mangoDB
        3
    mangoDB  
       Sep 3, 2021
    az22c
        4
    az22c  
    OP
       Sep 3, 2021
    @ratazzi
    @yzwduck
    @mangoDB
    哦哦 原来如此,rsync 也可用于取代 cp 指令
    610915518
        5
    610915518  
       Sep 3, 2021
    rsync 永远滴神!
    AllenHua
        6
    AllenHua  
       Sep 3, 2021   ❤️ 1
    @yzwduck #2
    使用 rsync --exclude -a
    建议使用 -a 参数而不是 -r
    因为 -a 参数是比-r 参数更合理、更建议使用的参数,能够递归复制、复制原始文件的元信息(比如拥有者、创建时间、最近一次修改时间等),-r 只能递归复制

    see also: https://hellodk.cn/post/591 https://www.ruanyifeng.com/blog/2020/08/rsync.html
    phony2r
        7
    phony2r  
       Sep 4, 2021
    git clone src dist
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3598 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 11:00 · PVG 19:00 · LAX 04:00 · JFK 07:00
    ♥ Do have faith in what you're doing.