Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Currently i need to create a shell script on my gameserver that will have to upload the day's CSS log files to another server...however i have no idea how to do this using ftp, since ftp only takes as arguments the hostname and port of the server in the following fashion..
ftp host port
and then drops into interactive mode. how can i make it upload a file named server.log to another ftp server ?
i used lftp <hostname> -u username,password -c mput *.log and lftp logged into the server and dropped me into a command line.. however the transfer of the log files did not start...
Thanks a lot! you were really of great help...i still wonder however why the command -c wouldnt work..AFAIK i was doing everything according to the manual of lftp :S
Even without knowing the lftp command at all, I can tell you that double quotes won't help. The problem is that the shell will expand *.log into the list of files (in your current directory) which happen to have the .log filename extension, before passing everything to lftp. So, lftp will get to see something like:
... -c a.log b.log c.log etc
instead of '*.log'.
To prevent the shell from interpreting "*.log", you need to put it in SINGLE quotes, not double quotes.
It is probably better to enclose the entire FTP command in single quotes.
It may work, but it actually does (in FTP):
mput file1.log file2.log file3.log ...
not
mput *.log
This is a subtle difference, since both FTP commands should -in theory- work equally well. You may get into trouble if you have really many .log files with your approach. The single quote approach should always work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.