IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    rsync 忽略 node_modules 目录

    亢奋猫发表于 2023-09-28 14:18:49
    love 0

    你可以使用 rsync 命令来复制 packages 目录内的所有文件到 target 目录,同时忽略 node_modules 目录。以下是一个示例 Bash 脚本:

    #!/bin/bash
    
    # 源目录
    source_directory="./source/"
    
    # 目标目录
    target_directory="./target/"
    
    # 使用 rsync 复制目录
    rsync -av --exclude 'node_modules/' "$source_directory" "$target_directory"
    
    echo "复制完成!"

    这个脚本中的 rsync 命令会递归地复制 source 目录内的所有文件和子目录到 target 目录。--exclude 'node_modules/' 选项用于忽略复制过程中的 node_modules 目录。

    请确保将 source 替换为实际的源目录路径,将 target 替换为实际的目标目录路径,然后运行这个脚本以执行复制操作。



沪ICP备19023445号-2号
友情链接