LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-20-2009, 05:09 AM   #1
peddip
Member
 
Registered: Dec 2008
Posts: 51

Rep: Reputation: 16
Perl script to download the files from FTP server


Hi,

I have a Perl script which downloads files from our FTP server to client.
Now my requirement is as below,

1. we have a directory structure in ftp server and we have the same directory structure in our ftp client.

2.I want to download the file in such a way that the flies from the respective directory in server should go the same directory in ftp client.

ex:

server has /dir1/file1

client has /dir1/

it has to place the file from server dir1 to client dir1.

is there any way to do it using Perl script.

Thanks in advance.
 
Old 03-20-2009, 07:18 AM   #2
netman4ttm
Member
 
Registered: Aug 2007
Distribution: FreeBSD 8.0 xubuntu
Posts: 49

Rep: Reputation: 16
This doesn't answer your question, but I think rsync would be the better solution. It will do exactly what you are looking to do "out of the box"
 
Old 03-20-2009, 09:10 AM   #3
omes
Member
 
Registered: Jan 2003
Distribution: debian, FreeBSD
Posts: 120

Rep: Reputation: 15
Quote:
Originally Posted by netman4ttm View Post
This doesn't answer your question, but I think rsync would be the better solution. It will do exactly what you are looking to do "out of the box"
Indeed, and in case you want it to be initiated from web (cgi-bin eg.) you can just wrap it into perl through the system command or the likes.
 
Old 03-23-2009, 03:52 AM   #4
peddip
Member
 
Registered: Dec 2008
Posts: 51

Original Poster
Rep: Reputation: 16
I think rsync will not help me as i don't have any access to FTP server, we have a ftp user login created in the FTP server. We have a script in place now which downloads the latest files to our local client, but i want a script to download the files in such a way that each and every file goes to the respective directory or sub directory assuming that we have same directory structure in bot FTP server and client.

requirement is some thing like below:

server has a file xyz.tar in /xyz/directory and i want that file to downloaded and copied to our client in /xyz/directory.

both our client and server has same directory structures.

Last edited by peddip; 03-23-2009 at 03:53 AM.
 
Old 03-23-2009, 09:49 AM   #5
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by peddip View Post
I think rsync will not help me as i don't have any access to FTP server, we have a ftp user login created in the FTP server. We have a script in place now which downloads the latest files to our local client, but i want a script to download the files in such a way that each and every file goes to the respective directory or sub directory assuming that we have same directory structure in bot FTP server and client.

requirement is some thing like below:

server has a file xyz.tar in /xyz/directory and i want that file to downloaded and copied to our client in /xyz/directory.

both our client and server has same directory structures.
Many ftp clients support recursive downloads. You might have an easier time getting one that does and simply using either the builtin automation (some ftp binaries will take a file as input) or using expect.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP files to remote server with a shell script Pezzoni Linux - Software 2 06-27-2007 07:01 AM
perl files download instead of parsed on apache2 mod-perl2 not parsing perl files zeigerpuppy Debian 1 02-16-2006 05:31 AM
Perl, script to serve files from another server Ctawp Programming 2 11-26-2004 09:07 PM
I want to download ftp-site files via wget and socks5 proxy server. jiawj Red Hat 2 10-28-2004 03:32 PM
SCRIPT: backup defined files/dirs to FTP-server markus1982 Linux - Software 0 05-25-2003 06:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration