PDA

View Full Version : Recursive FTP


DanSandberg
17th October 2008, 04:10 PM
Hi All,

I have a stupid question. I need to upload an entire hierarchy of files, folders within folders, etc.. Everything is located inside this one folder but the "get" command with FTP "can't get non-regular file". How do I get the entire folder and everything inside in a recursive way? get -R didn't work.

Thanks,
Dan

Nokia
17th October 2008, 04:15 PM
Try mget instead of get

aleph
17th October 2008, 04:45 PM

I'd suggest using lftp (yum install lftp). It is a very flexible FTP client. With its "mirror" command you can download/upload entire directory hierarchies in a few keystrokes.

The "mirror" command by default only does the download. "mirror -R" does the reverse (putting files *to* the server). In lftp, the command "help mirror" tells you whole lots of useful information.

php1ic
17th October 2008, 05:11 PM
I've only had experience with transferring between networks, so don't know how different that is to transferring to/from a server, but could you not use "scp -r"

DanSandberg
17th October 2008, 05:35 PM
Okay - what I'm actually trying to do is upload webpage information from my mac to the linux server hosting the webpage. I ssh into the server and then sftp back to my own computer. Mget produced the same error as get, 'could not open non-regular file'. scp -r isn't a valid command and for some reason yum isn't recognized either.

Could I compress the folder into a single object, ftp it to the linux server, and then decompress it? If so, does anyone know what compression software I'd need for this (a free program would be ideal)

Nokia
17th October 2008, 05:46 PM
Take a good look at man scp before trying anything else ;)

Your answer is: scp -2vr local/folder user@linuxserver.com:

That should be all

P.S. Take a look at su
yum install sshfs
man sshfs

php1ic
17th October 2008, 05:47 PM
Sorry, I thought scp was a standard command. I'm also under the impression that tar is so sorry in advance if it isn't recognised.

tar cvzf dir.tar.gz dir/

will compress and tar the directory into a single file (dir.tar.gz) which you can transfer

tar xvzf dir.tar.gz

should then uncompress and untar the file.

Nokia
17th October 2008, 06:01 PM
Sorry, I thought scp was a standard command. I'm also under the impression that tar is so sorry in advance if it isn't recognised.

tar cvzf dir.tar.gz dir/

will compress and tar the directory into a single file (dir.tar.gz) which you can transfer

tar xvzf dir.tar.gz

should then uncompress and untar the file.

Right. However, it's not needed in this case. :) scp -2vrC will enable compression when transfering files. There's no point in creating a local archive and decompressing it remotely. (Wonder if he's allowed to do that :) )

DanSandberg
17th October 2008, 06:10 PM
Hi great. scp seems to be the answer, although tar would work too. Thanks alot!