[CentOS] tar-ing subdirectories separately

Mon Jan 24 13:00:36 UTC 2011
Leonard den Ottolander <leonard at den.ottolander.nl>

Hello Johan,

On Sun, 2011-01-23 at 14:51 -0600, Johan Martinez wrote:
> I want to backup a directory using tar, but want separate tarballs for
> each subdirectory. For example:  # ls dir1
> subdir1 subdir2 subdir3

Use find(1) for such cases.

$ find <dir> -mindepth 1 -maxdepth 1 -type d -exec tar cz {} -f {}.tgz \;

Regards,
Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research