Downloading FTP Files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Downloading FTP Files
# 1  
Old 05-27-2011
Java Downloading FTP Files

Hi every one,
I have the requirement to download the files from FTP and move those files to unix box. Once after coping the files, i need to remove the files in FTP.
I'm a newbie in Unix script. Can you please suggest a script for this.. Thanks in advance..
# 2  
Old 05-27-2011
A little clarification to help you

ftp is a program to exchange (send or receive) files from another computer system. So, you do not get from an ftp - but rather write commands for ftp to get files.

So, what I think you are trying to do is:

From your unix computer
have a script to
Code:
start the ftp program
open a connection to another computer
(this must accept ftp; you might need to enable this)
get a file
(if allowed) remove the original file
close your connection 
close the ftp program

Is this what you are looking to do?
# 3  
Old 05-27-2011
Thanks for the clarification -- see the below script

Thanks for the input Joe..

As you said i can tie up the ftp server with the local unix server. Since 'm going to run the script in unix server only. I'm stucking up when i need to read the files in that folder (Since there is no constant file name) and copy those files in unix server path.

#!/bin/ksh
#ftp script filename:
print "script begins"
host='xxxx'
USER='xxxx'
PASSWORD='xxxx'
ftp -ndiv "${host}" << EOF
user $USER $PASSWORD
cd ftp file path ##path where files are present in the FTP path ####
get ftp files ####file name which should be extracted####
bye
EOF
print "script copied files from data from FTP to Server"

---------- Post updated at 03:48 PM ---------- Previous update was at 02:47 PM ----------

Thanks Joe.. As you instructed i tried with command and replicated the same in the script.. it works fine.

But i 'm using mget *.* to download the files and putting into my unix box. As far as my requirement i have single file in that unix folder path. How to change the name of the file to a user defined file name. Please suggest. Thanks..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing 2 text files & downloading a file if the last lines are different

Hello I'm having a little difficulty in writing a shell script for a few simple tasks. First I have two files "file1.txt" and "file2.txt" and I want to read and compare the last line of each file. The files look like this. File1.txt File2.txt After comparing the two lines I would... (2 Replies)
Discussion started by: RustikGaming
2 Replies

2. Shell Programming and Scripting

downloading mutilple files

hey i have a text file thats filled with info like this $ cat /private/var/lib/apt/lists/idwaneo.org_repo_._Packages Package: org.idwaneo.ldid Priority: optional Section: iDWANEO.org Maintainer: Admin <admin@idwaneo.org> Architecture: iphoneos-arm Version: 610-5 Pre-Depends: dpkg... (1 Reply)
Discussion started by: lewisdenny
1 Replies

3. UNIX for Dummies Questions & Answers

Crontab Wget, downloading a file to a FTP

Hi there, I've got my own domain, ftp etc.. I'm using cPanel and I want to download a file periodically, every say 24 hours. I've used this command: wget -t inf http : / / www . somesite . com / webcam.jpg ftp : / / i @ MyDomain . net : Password @ ftp . MyDomain . net^no spaces... (24 Replies)
Discussion started by: zYx
24 Replies

4. UNIX for Advanced & Expert Users

Dynamic Downloading and executing of ELF files

Dear Group, I want to prepare an ELF file which can be downloaded dynamically to any address in the moemory and executes as a new task/thread/process. 1) for this what are all the compileation, linker options while building the ELF file? 2) which parts of ELF file has to modified while... (1 Reply)
Discussion started by: ravinder.are
1 Replies

5. Shell Programming and Scripting

shell script - ftp downloading serveral files without mget

Hello guys, i'm searching for a solution how to download all files from root-directory of an ftp-server through an ftp proxy getting through the ftp proxy and download one file with get ist no problem, but mget * does nothing! ftp -n -i -v <<EOF open proxyHost proxyPort user... (19 Replies)
Discussion started by: macProgger23
19 Replies

6. Filesystems, Disks and Memory

Not able to FTP the files to a FTP server

Hi , We are facing a weird problem in our project. we need to send some xml & audio files to a remote FTP server from a Linux box, we are doing this in Perl script using Net::FTP->. Issue here is.. when FTPed the files using Perl scripts, only empty files ( 0 byte) are getting created on the... (2 Replies)
Discussion started by: kishorepotta
2 Replies

7. Shell Programming and Scripting

Problem in Downloading one day old files from FTP site

HI, I'm downloading one day old files from ftp site. Below is my script ---------------------------- printf "open $HOST \n" > ftp.cmd printf "user $USER $PASSWD\n" >> ftp.cmd printf "bin\n" >> ftp.cmd #printf "cd /Models/\n" >> ftp.cmd printf "prompt\n" >> ftp.cmd printf "for oldfile... (4 Replies)
Discussion started by: shekhar_v4
4 Replies

8. UNIX for Advanced & Expert Users

downloading through ftp

i have been busy getting accustomed to ssh and ftp and have a remote account that I am trying to comprehend.. my question is when I use ftp, ssh and remote accounts where do I download packages to.. which directory.. i have a cooledit package that is tarred and gziped which I ncftpd from... (6 Replies)
Discussion started by: moxxx68
6 Replies

9. UNIX for Dummies Questions & Answers

Downloading whole directory with FTP

Is it possible using FTP to download a whole directory and all subdirectories at once without having to go through every single file? Thanks, Tom (4 Replies)
Discussion started by: Pokeyzx
4 Replies

10. UNIX for Dummies Questions & Answers

downloading folders in ftp

can you download folders when in ftp or is the only way to download more then one file by mget?? (6 Replies)
Discussion started by: eloquent99
6 Replies
Login or Register to Ask a Question