I want to duplicate a directory on an FTP server I'm connected to from my Mac via the command-line

Let's say I have file. I want to have files2 with all of file's subdirectories and files, in the same directory as the original. What would be the simplest way to achieve this?

(I´m a complete newbie to the UNIX command line, so sorry if the question is not clear enough; please ask for any clarification needed.)

EDIT:

With mget and mput you could download all files and upload them again into a different folder but this is definitely NOT what i want/need (I started this question trying to avoid duplicating with this download upload method from the dektop client)

5 Answers
5

What you have is not a unix command line, what you have is an FTP session. FTP is designed primarily to upload and download files, it's not designed for general file management, and it doesn't let you run arbitrary commands on the server. In particular, as far as I know, there is no way to trigger a file copy on the server: all you can do is download the file then upload it under a different name.

Some servers support extensions to the FTP protocol, and it's remotely possible that one of these extensions lets you copy remote files. Try help site or remotehelp to see what extensions the server supports.

If you want a unix command line, you need remote shell access, via rsh (remote shell) or more commonly in the 21st century ssh (secure shell). If this is a web host, check if it provides ssh access. Otherwise, contact the system administrator. But don't be surprised if the answer is no: command line access would be a security breach in some multi-user setups, so there may be a legitimate reason why it's not offered.

It doesnt seem to be working, I failed to mention (because I though it would be the same) that I am trying to do this via an FTP connection established from a mac terminal. It gives me this error: 'cp' macro not found. Thanks
–
TrufaNov 11 '10 at 17:53

Thanks"" looks nice, will take a look! One more question, when I acces through the cPanel to the file administrator? What am I doing, becuse it seems the hell faster to do some things than trough ftp.
–
TrufaNov 12 '10 at 12:56