Tar: create archive exclude directories except one
我有一些目录和一些文件
1 2 3 4 5 6 7 8 9 | dir_archive/somedir1 dir_archive/somedir2 dir_archive/somedir3 dir_archive/mydir dir_archive/mydir/excludedir1 dir_archive/mydir/excludedir2 dir_archive/mydir/excludedir3 dir_archive/mydir/many_other_directories... dir_archive/mydir/my_archive_dir |
我要创建tar(gz)archive dir_archive.tar.gz,所有文件和目录都不包括
1 2 3 4 | dir_archive/mydir/excludedir1 dir_archive/mydir/excludedir2 dir_archive/mydir/excludedir3 dir_archive/mydir/many_other_directories... |
但包括
1 | dir_archive/mydir/my_archive_dir |
我不想对每个目录使用
1 | tar cvfz dir_archive.tar.gz --exclude=dir_archive/mydir/excludedir1 --exclude=dir_archive/mydir/excludedir2 --exclude=dir_archive/mydir/excludedir3 |
我试着用
1 | tar cvfz dir_archive.tar.gz --exclude=dir_archive/mydir --add-file=dir_archive/mydir/my_archive_dir dir_archive |
存在一些简单的方法吗?谢谢
一路excluding摇篮第一
1 2 3 | tar cvf dir_archive.tar --exclude=dir_archive/mydir dir_archive tar rvf dir_archive.tar dir_archive/mydir/my_archive_dir gzip dir_archive.tar |
不幸的是他/她不zipped appending工作与档案。P></
1 | tar cvfz dir_archive.tar.gz --exclude=dir_archive/mydir/exclude* dir_archive |
is also possible to create a en文件与档案名称???你想给list to that included和焦油与期权(或相似
1 2 3 4 5 6 7 | filelist.txt: dir_archive dir_archive/temp1 dir_archive/mydir dir_archive/mydir/temp2 dir_archive/mydir/my_archive_dir dir_archive/mydir/my_archive_dir/temp7 |
1 | tar cvfz dir_archive.tar.gz --no-recursion --files-from filelist.txt |