Prev: split in memory
Next: Bash Zenity help
From: Lao Ming on 17 Dec 2009 01:08 I want to copy all of my C code in one directory hierarchy into one compressed file. Excepting those with a name containing "chart". This is how I began: find . -name "*.c" |grep -v "chart" | { while IFS=' ' read file do At this point, I imagine that I would add one file at a time in the loop to tar and then when the loop finishes, gzip the tar file. But I'm unsure about how to proceed. thanks. Lao-Ming
From: Janis Papanagnou on 17 Dec 2009 01:24 Lao Ming wrote: > I want to copy all of my C code in one directory hierarchy > into one compressed file. Excepting those with a name containing > "chart". How to append arguments to commands from data that you get from standard input see: man xargs Janis > > This is how I began: > > find . -name "*.c" |grep -v "chart" | > { > while IFS=' > ' read file > do > > At this point, I imagine that I would add one file at a time > in the loop to tar and then when the loop finishes, gzip the tar file. > But I'm unsure about how to proceed. > > thanks. > > Lao-Ming
From: jellybean stonerfish on 17 Dec 2009 02:14 On Wed, 16 Dec 2009 22:08:22 -0800, Lao Ming wrote: > I want to copy all of my C code in one directory hierarchy into one > compressed file. Excepting those with a name containing "chart". > > This is how I began: > > find . -name "*.c" |grep -v "chart" | { > while IFS=' > ' read file > do > > At this point, I imagine that I would add one file at a time in the loop > to tar and then when the loop finishes, gzip the tar file. But I'm > unsure about how to proceed. > > thanks. > > Lao-Ming If your tar supports "--exclude=" then tar -vczf /path/to/save.tar.gz --exclude='*chart*' *.c
From: Stephane CHAZELAS on 17 Dec 2009 02:49 2009-12-16, 22:08(-08), Lao Ming: > I want to copy all of my C code in one directory hierarchy > into one compressed file. Excepting those with a name containing > "chart". > > This is how I began: > > find . -name "*.c" |grep -v "chart" | > { > while IFS=' > ' read file > do > > At this point, I imagine that I would add one file at a time > in the loop to tar and then when the loop finishes, gzip the tar file. > But I'm unsure about how to proceed. [...] find . -name '*.c' ! -name '*chart*' -type f | pax -w | compress > x.tar.Z -- St�phane
From: Lao Ming on 17 Dec 2009 15:36
On Dec 16, 11:14 pm, jellybean stonerfish <stonerf...(a)geocities.com> wrote: > On Wed, 16 Dec 2009 22:08:22 -0800, Lao Ming wrote: > > I want to copy all of my C code in one directory hierarchy into one > > compressed file. Excepting those with a name containing "chart". > > > This is how I began: > > > find . -name "*.c" |grep -v "chart" | { > > while IFS=' > > ' read file > > do > > > At this point, I imagine that I would add one file at a time in the loop > > to tar and then when the loop finishes, gzip the tar file. But I'm > > unsure about how to proceed. > > > thanks. > > > Lao-Ming > > If your tar supports "--exclude=" then > > tar -vczf /path/to/save.tar.gz --exclude='*chart*' *.c Thanks -- this would be perfect except that it only tarred and gzipped one file that it found in the current directory and not all the files from the entire hierarchy (which there are many). I used it exactly as specified except, of course, the path to the output file. |