LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-26-2009, 07:49 AM   #1
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
not able to perform ftp of tar archive


hi all............

FILE_NAME="/path/to/tar.gz"
HOST='localhost'
USER='usr'
PASSWD='passwd'
ftp -n $HOST <<End_of_session
user $USER $PASSWD
get $FILE_NAME /home/vinay/softwares/tar.gz
bye
End_of_session

this is my script...

I am not able to get tar.gz its transferring empty tar.gz folder

can anyone help me please......
 
Old 05-26-2009, 08:12 AM   #2
fpmurphy
Member
 
Registered: Jan 2009
Location: /dev/ph
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 299

Rep: Reputation: 62
Does the get work when you manually try to ftp the file?
 
Old 05-26-2009, 08:15 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
get $FILE_NAME /home/vinay/softwares/tar.gz
this is wrong. You cannot transfer more than one file using get. You have to use mget. If your intention is to transfer the file to some specific location into the local machine, you have to do something like:
Code:
lcd /home/vinay/softwares/
get $FILE_NAME
 
Old 05-27-2009, 05:58 AM   #4
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Original Poster
Rep: Reputation: 55
lcd /home/vinay/softwares/
get $FILE_NAME...is not working


FILE_NAME="/home/vinay/mysql-5.1.31-linux-i686-glibc23.tar.gz"
HOST='localhost'
USER='usrname'
PASSWD='passwd'
ftp -nv<<End_of_session
open $HOST
user $USER $PASSWD
mget $FILE_NAME /home/vinay/softwares/mysql-5.1.31-linux-i686-glibc23.tar.gz
bye
End_of_session

i am getting error near mget ...can anyone help me please..

Thanks in advance...
 
Old 05-27-2009, 06:12 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
mget $FILE_NAME /home/vinay/softwares/mysql-5.1.31-linux-i686-glibc23.tar.gz
You can't put the full path in get/mget. You have to change directory, then download the file:
Code:
cd /home/vinay/softwares/
get mysql-5.1.31-linux-i686-glibc23.tar.gz
If you download a single file use get, if you download multiple files at once use mget. When using mget, consider the -i option of ftp:
Code:
ftp -inv << End_of_session
so that you're not prompted for confirmation each time it tries to download a file (this is the default behavior of mget).
 
Old 05-27-2009, 07:01 AM   #6
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Original Poster
Rep: Reputation: 55
here i am trying to get tar.gz from my home directory to /home/vinay/softwares directory..........


FILE_NAME="/home/vinay/mysql-5.1.31-linux-i686-glibc23.tar.gz"
HOST='localhost'
USER='vinay'
PASSWD='passwd'
ftp -inv <<End_of_session
open $HOST
user $USER $PASSWD
cd /home/vinay/softwares
mget $FILE_NAME mysql-5.1.31-linux-i686-glibc23.tar.gz
bye

still not working........any error in this......

any help???please........

Last edited by vinaytp; 05-27-2009 at 07:04 AM.
 
Old 05-27-2009, 07:58 AM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Yes, the mget statement is still wrong or at least I cannot understand it. If we substitute $FILE_NAME with its value, we have:
Code:
mget /home/vinay/mysql-5.1.31-linux-i686-glibc23.tar.gz mysql-5.1.31-linux-i686-glibc23.tar.gz
as you can notice there are two errors: first, the complete path cannot be specified in the mget statement (you have to previously cd in the directory as I explained in my previous post); second, the two files are the same... and at this point I don't understand what do you want to do.

Questions:
0) do you want to download the file mysql-5.1.31-linux-i686-glibc23.tar.gz from the remote machine?
1) in which directory is placed the file mysql-5.1.31-linux-i686-glibc23.tar.gz on the remote machine?
2) in which directory you want to download the file on your local machine?
 
Old 05-27-2009, 08:12 AM   #8
ermoreno
LQ Newbie
 
Registered: May 2009
Location: San Antonio, Texas
Distribution: AIX, RHEL
Posts: 8

Rep: Reputation: 0
I work for a newspaper and I am constantly sending files through ftp, this is from one of my scripts.

ftp -v -n ftp.sleepy.com << EOF=20
user username password
prompt
cd /mysanantonio/specsec
mkdir R-SPS-$newDir-tab
cd R-SPS-$newDir-tab
bin
mput *.pdf
quit
EOF
echo "If you got here this section would uploading right now"
 
Old 05-27-2009, 08:22 AM   #9
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Original Poster
Rep: Reputation: 55
Thank a lot for colucix and ermoreno............

Last edited by vinaytp; 05-27-2009 at 08:24 AM.
 
Old 05-27-2009, 08:41 AM   #10
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Does it work, now?
 
Old 05-27-2009, 11:20 PM   #11
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Original Poster
Rep: Reputation: 55
yes....
 
  


Reply



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
How to perform FTP move Canis Polaris Linux - Newbie 3 02-18-2009 05:59 PM
Piping tar bzcat to add a file to a tar.bz2 archive DaveQB Linux - Software 0 06-02-2008 08:28 PM
Tar not able to perform backup on tape drive livetoday Red Hat 2 09-29-2007 03:16 AM
Tar gives error when creating a tar file archive davidas Linux - Newbie 10 04-13-2004 12:35 AM
this doesn't look like a tar archive .phister Slackware 5 02-01-2004 01:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:57 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
Open Source Consulting | Domain Registration