Re: Is it possible to get wget --content-disposition to overwrite an existing file.

2024-03-03 Thread Mark Sapiro

On 3/3/24 10:35 AM, Tim Rühsen wrote:


Wget tries not to overwrite files.

But if you want to remove the old file, no matter what, why don't you 
remove (or rename) that file before calling wget?



Thanks for the response. I understand that I can do that, but the wget 
is part of an automated Python script. I had already modified that 
script to rename the downloaded file, but in the interest of 
simplification I wanted to just do the whole thing with a single call to 
`wget --content-disposition`.


Anyway, this is all moot now. Originally, the script was using Python's 
urllib.request module to retrieve the file, but the server recently 
started blocking GETs from that module so I started using wget instead. 
I then realized I could set the User-Agent header in the GET request to 
avoid the block, and that's what I'm doing now.


--
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan




Re: Is it possible to get wget --content-disposition to overwrite an existing file.

2024-03-03 Thread Tim Rühsen

On 2/25/24 03:40, Mark Sapiro wrote:
As far as I can tell, the only way to get wget to overwrite an existing 
file is with the `-O` option, but I want to use `--content-disposition` 
to write the output to the filename in the Content-Disposition: header. 
This works, but if the filename already exists it writes to filename.1 
instead. Is there a way to get it to overwrite the existing file?




Wget tries not to overwrite files.

But if you want to remove the old file, no matter what, why don't you 
remove (or rename) that file before calling wget?


Regards, Tim


OpenPGP_signature.asc
Description: OpenPGP digital signature


Is it possible to get wget --content-disposition to overwrite an existing file.

2024-02-24 Thread Mark Sapiro
As far as I can tell, the only way to get wget to overwrite an existing 
file is with the `-O` option, but I want to use `--content-disposition` 
to write the output to the filename in the Content-Disposition: header. 
This works, but if the filename already exists it writes to filename.1 
instead. Is there a way to get it to overwrite the existing file?


--
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan