V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
az22c
V2EX  ›  macOS

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

  •  
  •   az22c · 2021-09-03 19:19:16 +08:00 · 1812 次点击
    这是一个创建于 938 天前的主题,其中的信息可能已经有所发展或是发生改变。
    其实问题等同于这个问题:(只不过我是 macos 用不了里面介绍的复制的指令和软件)
    https://superuser.com/questions/940804/copy-large-number-of-files-but-exclude-certain-sub-folders-on-windows
    7 条回复    2021-09-04 17:18:27 +08:00
    ratazzi
        1
    ratazzi  
       2021-09-03 19:45:14 +08:00 via iPhone
    rsync 啊
    yzwduck
        2
    yzwduck  
       2021-09-03 19:47:32 +08:00   ❤️ 1
    * rsync -r --exclude node_modules source target
    * bsdtar -c --exclude node_modules -C source . | bsdtar -x -C target
    mangoDB
        3
    mangoDB  
       2021-09-03 20:15:16 +08:00
    az22c
        4
    az22c  
    OP
       2021-09-03 20:24:31 +08:00
    @ratazzi
    @yzwduck
    @mangoDB
    哦哦 原来如此,rsync 也可用于取代 cp 指令
    610915518
        5
    610915518  
       2021-09-03 21:22:47 +08:00
    rsync 永远滴神!
    AllenHua
        6
    AllenHua  
       2021-09-03 23:39:40 +08:00   ❤️ 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  
       2021-09-04 17:18:27 +08:00
    git clone src dist
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2848 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:42 · PVG 19:42 · LAX 04:42 · JFK 07:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.