Home  >  Q&A  >  body text

linux - `cp`命令在拷贝整个目录的时候是否可以不包括隐藏文件?

以下的命令可以拷贝目录并显示拷贝的过程,但包含了隐藏的文件。

$ cp -dPrfv config/ temp/

使用rsync可以不包含隐藏文件,是否有可以显示拷贝过程的选项?

$ rsync --exclude=.svn config/ temp/ -rv

是否有什么命令可以满足如下的需求:

1、不拷贝隐藏的文件;
2、显示整个拷贝的过程。

迷茫迷茫2742 days ago767

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 13:18:53

    Use tar, for example:

    tar -cf - /path/to/source | ( cd /path/to/target; tar -xf -)
    

    If you want to see the process, add v. If you want to skip certain files, use --exclude, for example:

    tar --exclude '*.zip' -cvf - /path/to/source | ( cd /path/to/target; tar -xf -)
    

    reply
    0
  • Cancelreply