The following would rename any file in a directory (.anything) into numbers 

in the same extention i hope it will be usfull 

opendir(DIR,"$dir") or print "$!";
my @content = sort(readdir(DIR));
closedir(DIR);
my $no=0;
*foreach my* $number (@content){
$no++;
$number =~m/\S+\.(\S+)/;
rename("$dir/$number","$dir/$no.$1");}

by the way , you forgot to mention the directory you want to rename file in 

therefore you got this Error : can not rename file: No such file or 
directory 

rename("$dir/$file","$dir/$file");

bye

bye

Reply via email to