blob: 1a0249fe26cb7c9d5c50bd9b8edb224f5d425351 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/bin/perl
# remove non-alphanumerics from filenames in current directory
my @files = ();
opendir D, ".";
while (my $f = readdir D)
{
push @files, $f unless -d $f || $f =~ /^\./;
}
closedir D;
foreach my $f (@files)
{
my $newf = $f;
$newf =~ s/[^-_a-zA-Z0-9 .]//g;
next unless $newf;
print join " ", ("/bin/mv", $f,"\n", $newf, "\n");
system("/bin/mv", $f, $newf);
}
|