I have some directories with some files
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
I want create tar(gz) archive dir_archive.tar.gz with all files and directories exclude
dir_archive/mydir/excludedir1
dir_archive/mydir/excludedir2
dir_archive/mydir/excludedir3
dir_archive/mydir/many_other_directories...
but include
dir_archive/mydir/my_archive_dir
I dont want use --exclude
for each directory
tar cvfz dir_archive.tar.gz --exclude=dir_archive/mydir/excludedir1 --exclude=dir_archive/mydir/excludedir2 --exclude=dir_archive/mydir/excludedir3
I try use --add-file
, but it doesn't work:
tar cvfz dir_archive.tar.gz --exclude=dir_archive/mydir --add-file=dir_archive/mydir/my_archive_dir dir_archive
Exists some simple way? Thanks