I'm using curl in this syntax:
curl -o myfile.jpg http://mysite.com/myfile.jpg
If I run this command twice, I get two files:
How can I tell CURL that I want it to overwrite the file if it exists?
migrated from serverfault.com Aug 28 '11 at 16:23
This question came from our site for system and network administrators.
I met same problem and I want to reuse the same filename whatever server side gives, in your case you may get the filename by
then you can write a helper bash function like:
but in my case the filename is not even part of the url, it comes with content-disposition; with curl the command line is
you may ignore the
however, it still suffers refusing to overwrite if file name exists; I want it to overwrite if server side
ends up with a wget solution it's able to do so:
in your case, if you won't care timestamp, it's just