[CentOS] tar-ing subdirectories separately

2011-01-23 Thread Johan Martinez
I want to backup a directory using tar, but want separate tarballs for each subdirectory. For example: # ls dir1 subdir1 subdir2 subdir3 Will it possible to do it using only tar command? Or will I need another separate piece of logic/control? I thought of writing a shell script with three tar comm

Re: [CentOS] tar-ing subdirectories separately

2011-01-23 Thread Michel van Deventer
Hi, > I want to backup a directory using tar, but want separate tarballs for > each subdirectory. For example: > # ls dir1 > subdir1 subdir2 subdir3 > > > Will it possible to do it using only tar command? Or will I need > another separate piece of logic/control? I thought of writing a shell > s

Re: [CentOS] tar-ing subdirectories separately

2011-01-23 Thread Les Mikesell
On 1/23/11 2:51 PM, 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 > > Will it possible to do it using only tar command? No, tar only generates a single output stream. > Or wi

Re: [CentOS] tar-ing subdirectories separately

2011-01-24 Thread Leonard den Ottolander
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 -mindepth 1 -maxdepth 1 -type d -exec tar cz {

Re: [CentOS] tar-ing subdirectories separately

2011-01-24 Thread Nico Kadel-Garcia
On Mon, Jan 24, 2011 at 8:00 AM, Leonard den Ottolander wrote: > 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

Re: [CentOS] tar-ing subdirectories separately

2011-01-25 Thread Leonard den Ottolander
Hello Nico, On Mon, 2011-01-24 at 19:21 -0500, Nico Kadel-Garcia wrote: > On Mon, Jan 24, 2011 at 8:00 AM, Leonard den Ottolander > > $ find -mindepth 1 -maxdepth 1 -type d -exec tar cz {} -f {}.tgz \; > Ahh-ahh-ahh! You forgot some subdirectories, especially generated from > projects served to