$|=1; # So it works in the Open Perl IDE

chdir "d:/temp" or die "Couldn't change dir: $!"; # goto the dir with the files
@files = glob "*.bak"; # get the names of the changed files

mkdir "BAK" or die "Couldn't create directory: $!";

foreach $e (@files){ # do this for all files in the folder
  rename "$e","BAK/$e" or warn "Moving of $e failed: $!"; # move the file or warn
}

