LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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, 06: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, 08: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, 10: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, 04: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 04:53 AM.
 
Old 03-23-2009, 10:49 AM   #5
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
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 08:01 AM
perl files download instead of parsed on apache2 mod-perl2 not parsing perl files zeigerpuppy Debian 1 02-16-2006 06:31 AM
Perl, script to serve files from another server Ctawp Programming 2 11-26-2004 10:07 PM
I want to download ftp-site files via wget and socks5 proxy server. jiawj Red Hat 2 10-28-2004 04:32 PM
SCRIPT: backup defined files/dirs to FTP-server markus1982 Linux - Software 0 05-25-2003 07:06 AM


All times are GMT -5. The time now is 10:35 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration