同期

同期

この質問は、例えば説明するのが最も適していると思います。

/home
   test1.txt
   test2.txt
   /home/my-folder
      test3.txt
      test4.txt
  1. test1.txttest2.txtそしてmy-folderその中にあるフォルダ/home
  2. test3.txtそしてtext4.txt内部/home/my-folder

フォルダのすべての内容をコピーしたいのですが、/homeその中にある2つのファイルを除外したいと思います(test3.txtおよびtest4.txtmy-folder

これを行うにはどうすればよいですかcp

rsync試してみましたが、時にはrsyncサーバーにインストールされておらず、ソフトウェアをインストールする権限がないため、これが可能であることがわかります。

ベストアンサー1

find(1)以下を使用してこれを実行できますcpio(1)

find /home -path './my-folder/test[34].txt' -prune -o \( -type f -print \) | \
    cpio -pdamv /some/other/dir

おすすめ記事