LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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
 
LinkBack Search this Thread
Old 08-25-2006, 03:42 PM   #1
kniwor
Member
 
Registered: Aug 2005
Distribution: Slackware 12
Posts: 106

Rep: Reputation: 15
using ftp command


i often use ftp commant to get files over network, how do i transfer entire folders using it, preserving the folder structure.
 
Old 08-25-2006, 03:57 PM   #2
dombrowsky
Member
 
Registered: Dec 2005
Location: New York
Distribution: Debian/GNU
Posts: 235

Rep: Reputation: 30
there are as many FTP clients as there are operating systems and their flavors. Each one is different. I personally can't think of a way of using plain vanilla FTP fetch an entire folder structure. I know "get" will fetch a file and "mget" will fetch a set of files using a wildcard. Perhaps your ftp client implements something that will fetch entire folders. Try "man ftp" on the source server you're using and rtfm.

The easiest way I know of to copy folder structures across networks (without access to NFS or samba mounts) is to use SCP. SCP uses the SSH subsystem to connect to the remote host. The '-r' flag wil copy entire folders nicely. Therefore:
Code:
scp -r user@remote.host:/folder/to/copy .
will copy the entire contents of /folder/to/copy to the current directory, replicating the folder structure and all that. You can use this to copy from any machine that you have SSH access to. If you only have FTP access to the remote server, you'll have to read the ftp documentation for the client your using to see if there's a magic command to copy folders and their contents.
 
Old 08-25-2006, 04:02 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,527

Rep: Reputation: 147Reputation: 147
As far as I know ftp command (and ftp protocol) doesn't have such option. All the tools that allow you to do such things use basic commands to get the list of files and then download them one by one. For command line, midningh commander can mount an ftp share, it's quite useful (there's also a tool that allows to mount it normally, but I don't remember how the tool is called at the momemnt).
 
Old 08-26-2006, 04:16 AM   #4
firedance
Member
 
Registered: Dec 2003
Location: Sweden
Distribution: Arch Linux
Posts: 65

Rep: Reputation: 15
you could try wget with the -r option
wget -r ftp://userass@server:21/
 
Old 08-26-2006, 04:57 AM   #5
kniwor
Member
 
Registered: Aug 2005
Distribution: Slackware 12
Posts: 106

Original Poster
Rep: Reputation: 15
thanks a lot, as i wanted to use an ftp share, wget will do great. thanks for help. this solves the problem.

and while using the mget command how do i avoid confirmation and say yes to all.

also, using wget by default uses pasv, what if i intend to use port.

Last edited by kniwor; 08-26-2006 at 05:18 AM.
 
Old 08-26-2006, 05:27 AM   #6
SlackDaemon
Member
 
Registered: Mar 2006
Distribution: RedHat, Slackware, Experimenting with FreeBSD
Posts: 222

Rep: Reputation: 30
To avoid being prompted while using mget use the prompt command to toggle prompting off.
 
Old 08-26-2006, 06:07 AM   #7
firedance
Member
 
Registered: Dec 2003
Location: Sweden
Distribution: Arch Linux
Posts: 65

Rep: Reputation: 15
Add --no-passive-ftp to the commandline. btw, if you need more info check `man wget`
 
Old 08-26-2006, 09:42 AM   #8
kniwor
Member
 
Registered: Aug 2005
Distribution: Slackware 12
Posts: 106

Original Poster
Rep: Reputation: 15
thanks a lot
 
  


Reply

Tags
ftp, recursive


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP Command ishcoleobo Linux - Software 2 01-15-2006 08:41 PM
what is different with Ftp From browser and Ftp from command line zahra79 Linux - Networking 2 06-22-2005 03:26 AM
ftp command zaicheke Linux - Networking 2 11-20-2004 08:31 PM
ftp command kpachopoulos Linux - General 3 11-03-2004 02:36 PM
ftp command stefane321 Linux - Networking 1 09-10-2004 03:02 PM


All times are GMT -5. The time now is 03:06 PM.

Main Menu
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