Re: renaming files
On Sat, Jan 27, 2001 at 12:12:53PM +0100, Moritz Schulte wrote:
> "oj ." <pegoj@hotmail.com> writes:
>
> > I have a bunch of files (*.mp3) that have spaces and characteres
> > such as: ", ( ,_. I would like to remove all the spaces and
> > characteres and leave them as: xshkjds_jskdjks_jsdj.mp3.
>
> for name in *.mp3; do
> newname=$(echo "$name" | sed -e 's/[ "\(\),]//g')
> echo "Moving \"$name\" to \"$newname\""
> mv -i "$name" "$newname"
> done
Oh, goodness, that looks complex.
% rename 's/[ ,"()]/_/g' *.mp3
'rename' is almost certainly on your system (ie, it comes with perl, and
it's sorta hard to have a working debian system without perl).
--
CueCat decoder .signature by Larry Wall:
#!/usr/bin/perl -n
printf "Serial: %s Type: %s Code: %s\n", map { tr/a-zA-Z0-9+-/ -_/; $_ = unpack
'u', chr(32 + length()*3/4) . $_; s/\0+$//; $_ ^= "C" x length; } /\.([^.]+)/g;
Reply to: