How can I download the latest file available in ftp server using wget. If I am using the below command it is giving all the files.
wget ftp://id%3Apassword@ftpserver/dir/*
Regards, Ram.
|
How can I download the latest file available in ftp server using wget. If I am using the below command it is giving all the files. wget ftp://id%3Apassword@ftpserver/dir/* Regards, Ram. | |||||
feedback
|
This question came from our site for system administrators and desktop support professionals.
|
The answer is that you probably can't do this using just wget or any other single tool that I am aware of. What you probably need to do is write a script that will use wget/curl/whatever that will request a directory listing from the ftp server. Then the script will select and retrieve the right file based on the file's name, or some other criteria. | ||||
feedback
|
|
Just add the "-N" option to wget to ignore files older than what you have locally. You could also add the "-nc" to completely skip a file if it already exists, even if the one on FTP is newer. wget -N ftp://id%3Apassword@ftpserver/dir/* | |||
|
feedback
|
|
Try to specify the file you want to download. Using '*' will download every file in the directory 'dir'. Example:
...will download exactly the file 'welcome.msg' from the mentioned server. Check the Wget-Manual. Update: I'm not sure if I get your problem. Are you trying to sync the content of the remote server (machine running the FTP daemon) with your local server? Are you looking for something like rsync functionality over FTP? If yes, you could try ftpsync (wget alone won't help in this case). | |||||
feedback
|