#!/usr/bin/perl use warnings; use strict; use File::Find; our $VERSION = '0.1.3'; ### NAME NORMALIZER ### my $DIR = shift @ARGV; opendir TOCLEAN, $DIR or die "$DIR: $!"; my @dirs = map "$DIR/$_", grep -d "$DIR/$_" && !/\A\.\.?\z/, readdir TOCLEAN; finddepth sub { ( my $new = $_ ) =~ tr!a-zA-Z0-9.~-!_!c; return if $new eq $_; rename $_, $new or warn "Cannot rename '$_' to '$new' $!"; }, @dirs;