CoderZone.org

Category: >> Perl Code >> Convert Extensions To Lowercase Bookmark and Share

<< lastnext >>

Snippet Name: Convert Extensions To Lowercase

Description: Searches for files having uppercase extensions and converts them to lowercase.

Also see:
» Tabs-To-Space Converter
» Easily Change Text To Lowercase
» Count Uppercase Letters In A String
» Update/convert DB field to upperca...

Comment: (none)

Author: CoderZone
Language: PERL
Highlight Mode: PERL
Last Modified: December 03rd, 2010

#!/usr/bin/perl
$files=&#x60;ls&#x60;;
@files=split(/\n/,$files);
foreach (@files) {
    if(/(.*)\.((?:[A-Z]*[0-9]*\.*)+)$/) {
        $name=$1."."."\L$2\E";
        system("mv $_ $name")
    }
}
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 7