Gzip

Michael mogmios at mlug.missouri.edu
Tue Jul 23 03:14:02 CDT 2002


Try this (I didn't.. so be careful):

find . -type f -iname "*.mp3" -exec gzip -9 "{}" ;

Or if you want to change allthe files to lowercase try:

find . -type f -iname "*.mp3" -exec myscript.sh "{}" ;

Make myscript.sh:
FILE="$1"
NEWFILE=`echo "$FILE" | tr "[[:upper:]]" "[[:lower:]]"`
NEWFILE=`echo "$NEWFILE" | cut -d "." -f1-3`
mv "$FILE" "$NEWFILE"

Very rough but you get the idea..

> Hmmm...didn't think of that.  I used the xargs one david nicol sent me.
> That worked pretty well.  And it was more what I was looking for too...I
> remember seeing some shell magic somewhere that had all kinds of [brackets]
> and wierd variables to do something like that...
>
> Adding the .gz was okay.  Maybe what I was think of was something more along
> the lines of:
>
> music> ls -l
> song1.mp3
> song2.Mp3
> song3.MP3
> song4.mp3
> etc...
>
> How could I go about re-naming each file's extension so they were all
> lowercase while keeping the original filename, or for instance removing the
> .gz off all these files but keeping the filename?
>
> -Lucas
>
> ----- Original Message -----
> From: "Duane Attaway" <dattaway at attaway.net>
> To: "Lucas Peet" <lpeet at eccod.com>
> Cc: <kclug at kclug.org>
> Sent: Monday, July 22, 2002 7:47 PM
> Subject: Re: Gzip
>
>
> >
> >
> > On Mon, 22 Jul 2002, Lucas Peet wrote:
> >
> > > I need to gzip all the files in a specific directory...there's lots of
> > > them, and I'm not up for doing it by hand.  How can I gzip each file,
> > > while keeping it's original filename?
> >
> > hmmmm... let me find a directory I don't mind munging to try this out...
> > ok... it works!
> >
> > gzip *
> >
> > that would append a .gz to each filename, but you mentioned the name
> > shouldn't be changed, so, how about...
> >
> > gzip -S "" *
> >
> > would append a null suffix to each filename, leaving it unchanged;
> > however, the authors of gzip apparently do not wish to have that happen as
> > it burps out the following:
> >
> > gzip: incorrect suffix '(null)'
> >
> > :(
> >
> >
> >
> >
> >
>
>
>
>




More information about the Kclug mailing list