-   Linux - Newbie (
-   -   using ftp command (

kniwor 08-25-2006 04:42 PM

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.

dombrowsky 08-25-2006 04:57 PM

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:

scp -r .
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.

Mara 08-25-2006 05:02 PM

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).

firedance 08-26-2006 05:16 AM

you could try wget with the -r option
wget -r ftp://user:pass@server:21/

kniwor 08-26-2006 05:57 AM

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.

SlackDaemon 08-26-2006 06:27 AM

To avoid being prompted while using mget use the prompt command to toggle prompting off.

firedance 08-26-2006 07:07 AM

Add --no-passive-ftp to the commandline. btw, if you need more info check `man wget`

kniwor 08-26-2006 10:42 AM

thanks a lot

All times are GMT -5. The time now is 05:48 AM.