use File::Copy; #code removed move($file,$dir);