🪴 TAR all directories seperately
This is one way to create a .tar.gz file:
tar -cvzf <output filename> <directory>
this means: -c = create new archive -v = be verbose -z = compress using gzip -f = filename to create for the new archive
for the directory dont to directory/*
just to directory
with no slash
filenames should end in .tar.gz
as they are tarr’ed then zipped
TAR all directories in current directory
find * -maxdepth 0 -type d -exec tar -czf {}.tar.gz {} \;
Exclude a dir by name (dir named foo
)
find * -maxdepth 0 -type d -not -path "foo" -exec tar -czf {}.tar.gz {} \;
Exclude multiple dir
find * -maxdepth 0 -type d -not -path "foo" -path "bar" -exec tar -czf {}.tar.gz {} \;
Create tar at different path
find * -maxdepth 0 -type d -exec tar -czf somewhere/else/{}.tar.gz {} \;