How to move a file using Perl?

by Nithya 2010-02-04 14:13:50

You can move a file with Perl with the File::Copy module (yes, it also handles "move").

Example:

use File::Copy;

$original_file = 'original-filename.txt';
$new_file = 'new-filename.txt';

# the perl file move function
move($original_file, $new_file) or die "The move operation failed: $!";

Tagged in:

1310
like
0
dislike
0
mail
flag

You must LOGIN to add comments