in reply to Re^2: Rename not working
in thread Rename not working
use File::Spec::Functions qw( catfile ); use File::Basename qw( dirname ); my $src_qn = $x->{filename}; my $dir_qn = dirname($src_qn); my $dst_fn = "TEST$ext"; my $dst_qn = catfile($dir_qn, $dst_fn); rename($src_qn, $dst_qn) or die("...: $!\n");
My naming convention:
fn = unqualified file name
qn = qualified file name (i.e. rel or abs path)
fqn = fully qualified file name (i.e. abs path)
And only pass qn/fqn to system functions.
Some of the lines can be combined, but I wanted to be explicit for clarity and demonstration purposes.
|
|---|