Search This Blog

Monday, March 27, 2023

[Ubuntu] Create tar file exclude specified directory

Tar foo directory, and exclude "foo/.repo"  directory

─foo

   ├─.repo

   │     └─ example

   └─ 1.txt

$ tar -cvf foo.tar --exclude='foo/.repo' foo


Remove directory "foo/.repo" from tar file

$ tar --delete foo/.repo -f foo.tar