Mailinglist Archive: opensuse (2358 mails)
| < Previous | Next > |
Re: [SLE] Name Game
- From: cees-list@xxxxxxxxxxxxxxxx (Cees van de Griend)
- Date: Fri, 1 Oct 1999 13:23:30 +0200
- Message-id: <19991001132330.A6213@xxxxxxxxxxxxxxxx>
Hello Jon,
On Fri, Oct 01, 1999 at 12:10:18AM -0700, Jon Pennington wrote:
> 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 :).
Easy, use Perl.
Save this script as 'guru.pl' in your themes-dir <grin>.
Do a 'chmod +x guru.pl'.
Use it as: './guru.pl *'.
Good luck,
Cees.
---------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
foreach my $file (@ARGV) {
if ($file =~ /(.+)\[.+\]\.tar\.gz/) {
rename("$file", "$1.tar.gz") or
die("Can not rename $file to $1.tar.gz: $!\n");
print("Renamed: $file to $1.tar.gz\n");
} else {
print("Not recognized: $file\n");
}
}
---------------------------------------------------------------------
--
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 > |