I am using curl to download some files from a FTPS site. When i download the files from site to my machine the zip files date changes to the download time and date. I want to keep the original timestamp that is on the FTPS server. Please advise how to do this. If you can provide examples that would be gr8 i am new to curl.
Thanks
curl is the goto tool for anything HTTP related but you can also use it for your FTP and FTPS tasks.
To upload to an FTP server, you specify the entire target file path and name in the URL, and you specify the local file name to upload with -T, --upload-file . Optionally, you end the target URL with a slash and then the file component from the local path will be appended by curl and used as the remote file name.
To download a file with Curl, use the --output or -o command-line option. This option allows you to save the downloaded file to a local drive under the specified name. If you want the uploaded file to be saved under the same name as in the URL, use the --remote-name or -O command line option.
We can save the result of the curl command to a file by using -o/-O options. Now the page gettext. html will be saved in the file named 'mygettext.
The key is this command line option:
-R/--remote-time
When used, this will make libcurl attempt to figure out the
timestamp of the remote file, and if that is available make
the local file get that same timestamp.
... which then can be used like:
curl -R -O --ssl ftp://example.com/that/file/I/want.txt
(--ssl was formerly known as --ftp-ssl)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With