#!/usr/bin/perl -w
use strict;
use File::Copy;
my $source = "/original/dir/some_file";
my $dest = "/other/directory/";
move($source, $dest) or die "Error moving file: $!\n";
-- ar0n | Just Another Perl Joe
| [reply] [d/l] |
Hi,
This is what, your fifth post about file manipulation? and so far all the responses have been pretty helpful, but its going to be a long slow process learning perl if you ask questions every for every single problem.
perlfaq5 contains some if not all of the answers and the ActiveState docs contain help for the CGI/server side issues you are coming across with permissions.
From the command line: perldoc perlfaq5
Perl . Com for more links.
We can and probably will help, but docs are your friend. | [reply] |
You can usually just use rename(), though this is somewhat implementation-dependent. If you're under Unix and not moving the file across filesystems, this is simplest, as it just changes the directory entries. I believe File::Copy's move() function attempts this first, and if it fails, tries to copy the file and unlink the source, so that's probably your best bet. | [reply] [d/l] [select] |
agoth,
thanks for your advice.I'm really a beginner in perl,and also in perlmonks.I will try my best to do perl programming.
thanks again. | [reply] |