How can I upload an entire folder via FTP Mac Terminal?
Same as you would upload an entire folder from any other command line:
- Make a zip or tar archive out of it, then put the archive.
- If you want to upload individual files, but do them all, use "mput".
have you tried mput? You can pass it A wildcard (*) to upload all the files...
There seems to be some question as to whether ftp through the mac is capable of handling recursive copy.
If you have ssh access to both machines, you could do this from the source computer:
tar -cf - directory | ssh user@hostB "cd target_dir; tar -xf -"
mput * should work fine for objects within the directory, but if you have subdirectories, it may have problems picking up the files.
terminal>ftp user@host
password:xXxXx
ftp>mkdir <remote dir>
ftp>cd <remote dir>
ftp>lcd <local dir>
ftp>mput *
ftp>close
This will
- connect
- create the remote directory (or folder)
- cd into that directory
- cd to the local directory (if you didn't start there
- copy multiple files (all)
- log out again
Do you have to use ftp
? I like to use scp
(secure copy) when the remote host supports ssh (as so many of them do).
scp -r mydirectory [email protected]:destdir
The -r
means "recursive" so it will recursively copy the entire directory. Replace username
with your username, etc., etc. destdir
is a relative path on the remote server (whatever directory you wind up in if you log in) as long as you don't use a leading slash /
-- then it will be an absolute path.
mput is the right command for that task, but I think OS X' implementation of ftp command line client does not support recursive copy of directories via mput *.
So, a possible solution might be the use of an alternative ftp command line client like NcFTP that is shipped with many linux distributions and is also available for OS X. See NcFTP download page for details.
ncftpput -R -u user -p passwd <remote-host> <remote-dir> <local-dir>
The -R
is for recursive mode.