拷贝指定的文件出来但保持目录结构

抽取当前目录以下的所有logo1.* 或 logo2.* 到 /media/logo下

 

tar cvf - `find . -name "logo[1,2].*" -print` | (cd /media/logo;tar xvf - )

缺点:因为是拷贝所以占用多一倍空间。

 

如果文件列表多于3000个以上方法不行的,用下边的方法:

 

find . -name '*.txt' -print >/tmp/test.manifest
tar -cvzf textfiles.tar.gz --files-from /tmp/test.manifest
find . -name '*.txt' | xargs rm -v

你可能感兴趣的:(文件)