Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Net::FTP Move Files on the remote server.

Status
Not open for further replies.

Milleniumlegend

IS-IT--Management
Dec 16, 2003
135
Could someone please let me know how to move files on a remote server from one location to the other.

I have a file that I would like to send from my local server to a remote FTP Server. But before I send the file to the remote server I would like to get the files moved to another location on the remote FTP Server.

I initiate the transfer from my local PC to the remote server.

Could someone please let me know what command can I use to move the files on the remote server to another location.

Many Thanks
 
Hmm.. well to move files using FTP you do
Code:
mv [i]<file to move>[/i] [i]<new location>[/i]
Example
Code:
mv [i]backup.tar.gz[/i] [i]/home/archive/.[/i]

M. Brooks
 
I am under a Net::FTP session.

To login

$ftp->login("$destuser","$destpass") or $newerr=1;
push @ERRORS, "Can't login to $desthost: $!\n" if $newerr;

print DAT "Changing directory to $destdir\n";
$ftp->cwd($destdir) or $newerr=1;


How can I use the Net::FTP or similar Sessions to ensure that the files on the remote server have been moved to another location on the remote server.

Say when I connect I am in / and I want to move all files to /archive. How do I do that from within my session.

Many Thanks
 
Use NET::FTP::File like so
Code:
my $old = "/file.txt";
my $new = "/archive/file.txt"; 

$ftp->move($old, $new) or die $ftp->message;

M. Brooks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top