I have 1 directory with 9 subdirectories and 10 files. Subdirectory have next level subdirectories and files.

我有1个目录,包含9个子目录和10个文件。子目录具有下一级子目录和文件。

/home/directory/
/home/directory/subdirectory1
/home/directory/subdirectory2
...
/home/directory/subdirectory9
/home/directory/file1
...
/home/directory/file10

I want to copy all subdirectories and files recursivly excluding:

我想复制所有子目录和文件,但不包括:

/home/directory/subdirectory5
/home/directory/subdirectory7

What is the best way for it?

最好的方法是什么?

7 个解决方案

#1


8

Maybe the find command will help you:

也许find命令可以帮助你:

$ find /home/directory -mindepth 1 -maxdepth 1 -name 'subdirectory[57]' -or -exec cp -r {} /path/to/dir \;

更多相关文章

  1. Linux locate(文件搜索) 命令
  2. 开发板挂载vmware虚拟机linux下nfs服务器共享文件
  3. Linux 删除除了某个文件之外的所有文件
  4. linux设置了 /etc/profile ~/.bashrc等配置文件不重启生效方法【
  5. Inotify: 高效、实时的Linux文件系统事件监控框架
  6. Linux中/proc目录下文件详解之(二)
  7. Linux如何查找大文件
  8. Linux第三章 命令基本格式及文件处理命令
  9. NFS实现开发板和虚拟机之间的文件共享

随机推荐

  1. 彻底理解初始化参数SERVICE_NAMES和客户
  2. MySQL实现表之间的字段更新
  3. MYsql 5.1 安装过程报错 /bin/rm: cannot
  4. 自己写了一个简单的mysql数据库连接类
  5. mysql有时查询很慢的原因?
  6. MySQL 笔记(三)由 txt 文件导入数据
  7. MySQL 事务没有提交导致锁等待
  8. SQL Server基础知识之:设计和实现视图
  9. sql plus如何新建新用户
  10. mysql 配置 explicit_defaults_for_times