Perl/Shell Knowledge Sharing
Perl Interview Questions and Answers
Tuesday, December 28, 2010
Rename bunch of files
my @files = glob '*';
foreach (@files) {
if(/.pl/) {
($new = $_) =~ s/\.pl/\.plx/;
print "old: $_\nnew: $new\n\n";
rename $_ => $new;
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment