Mailinglist Archive: opensuse (2358 mails)
| < Previous | Next > |
Re: [SLE] Name Game
- From: maurizio@xxxxxxxxxxxxxxxxxxxxxxxxxx (Maurizio Firmani)
- Date: Fri, 1 Oct 1999 15:33:58 +0200
- Message-id: <99100115373600.12502@kamikazen>
On ven, 01 ott 1999, Jon Pennington wrote:
> Here's one for you scripting gurus;
>
> I have a directory with a bunch of tarballs in it (GTK+ themes, actually).
> Each of the names is like this:
>
> theme-name[1].tar.gz
>
> I want the names to be like this:
>
> theme-name.tar.gz
>
> Can't I write a script that will automatically rename all of the files? I
> have around 300 of them so far, and I'd really rather not do it by hand :).
>
This simple script should work for you:
#!/bin/sh
for i in `ls *.tar.gz`; do
echo "Renaming $i"
mv $i `echo $i | sed "s/\[.*\]//"`
done
Give it a name, chmod +x and then execute it.
Ciao
Maurizio
--
To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
| < Previous | Next > |