wget: how to download a served file keeping its name
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
A little IoT server returns a file, whose name is given by current date and time, to make it unique. The format is 2018.07.04.18.22.45.dat
.
Asking for address XX.XX.XX.XX:5001/read
in a browser (with browser cache disabled) the file is returned with its original name.
Using wget, alas, I cannot preserve the file name:wget XX.XX.XX.XX:5001/read
returns the proper content but with name read
, read.1
, read.2
, etc.
Is there the possibility to collect it keeping the name, using wget
or other commands?
ADDENDUM: using curl XX.XX.XX.XX:5001/read
I obtain the raw content instead of the file.
ADDENDUM: as a imperfect workaround, I can generate a filename based on timestamp with wget -o $(date "+%Y.%m.%d-%H.%M.%S.%N.dat") XX.XX.XX.XX:5001/read
. Of course it doesn't match the original filename.
wget
add a comment |Â
up vote
1
down vote
favorite
A little IoT server returns a file, whose name is given by current date and time, to make it unique. The format is 2018.07.04.18.22.45.dat
.
Asking for address XX.XX.XX.XX:5001/read
in a browser (with browser cache disabled) the file is returned with its original name.
Using wget, alas, I cannot preserve the file name:wget XX.XX.XX.XX:5001/read
returns the proper content but with name read
, read.1
, read.2
, etc.
Is there the possibility to collect it keeping the name, using wget
or other commands?
ADDENDUM: using curl XX.XX.XX.XX:5001/read
I obtain the raw content instead of the file.
ADDENDUM: as a imperfect workaround, I can generate a filename based on timestamp with wget -o $(date "+%Y.%m.%d-%H.%M.%S.%N.dat") XX.XX.XX.XX:5001/read
. Of course it doesn't match the original filename.
wget
Have you tried the--trust-server-names
option?
â ivanivan
Jul 4 at 17:42
Yes, @ivanivan, I tried it but gotread.X
anyway...
â Alex Poca
Jul 4 at 17:47
1
Have you tried the--content-disposition
option?
â Nick ODell
Jul 4 at 17:59
@Nick ODell, thank you! It works. Please move your comment to an answer so I can upvote it.
â Alex Poca
Jul 4 at 18:02
I also just found by chance the answer at unix.stackexchange.com/questions/394464/â¦. I completely missed it before.
â Alex Poca
Jul 4 at 18:05
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
A little IoT server returns a file, whose name is given by current date and time, to make it unique. The format is 2018.07.04.18.22.45.dat
.
Asking for address XX.XX.XX.XX:5001/read
in a browser (with browser cache disabled) the file is returned with its original name.
Using wget, alas, I cannot preserve the file name:wget XX.XX.XX.XX:5001/read
returns the proper content but with name read
, read.1
, read.2
, etc.
Is there the possibility to collect it keeping the name, using wget
or other commands?
ADDENDUM: using curl XX.XX.XX.XX:5001/read
I obtain the raw content instead of the file.
ADDENDUM: as a imperfect workaround, I can generate a filename based on timestamp with wget -o $(date "+%Y.%m.%d-%H.%M.%S.%N.dat") XX.XX.XX.XX:5001/read
. Of course it doesn't match the original filename.
wget
A little IoT server returns a file, whose name is given by current date and time, to make it unique. The format is 2018.07.04.18.22.45.dat
.
Asking for address XX.XX.XX.XX:5001/read
in a browser (with browser cache disabled) the file is returned with its original name.
Using wget, alas, I cannot preserve the file name:wget XX.XX.XX.XX:5001/read
returns the proper content but with name read
, read.1
, read.2
, etc.
Is there the possibility to collect it keeping the name, using wget
or other commands?
ADDENDUM: using curl XX.XX.XX.XX:5001/read
I obtain the raw content instead of the file.
ADDENDUM: as a imperfect workaround, I can generate a filename based on timestamp with wget -o $(date "+%Y.%m.%d-%H.%M.%S.%N.dat") XX.XX.XX.XX:5001/read
. Of course it doesn't match the original filename.
wget
edited Jul 4 at 18:00
asked Jul 4 at 17:36
Alex Poca
1245
1245
Have you tried the--trust-server-names
option?
â ivanivan
Jul 4 at 17:42
Yes, @ivanivan, I tried it but gotread.X
anyway...
â Alex Poca
Jul 4 at 17:47
1
Have you tried the--content-disposition
option?
â Nick ODell
Jul 4 at 17:59
@Nick ODell, thank you! It works. Please move your comment to an answer so I can upvote it.
â Alex Poca
Jul 4 at 18:02
I also just found by chance the answer at unix.stackexchange.com/questions/394464/â¦. I completely missed it before.
â Alex Poca
Jul 4 at 18:05
add a comment |Â
Have you tried the--trust-server-names
option?
â ivanivan
Jul 4 at 17:42
Yes, @ivanivan, I tried it but gotread.X
anyway...
â Alex Poca
Jul 4 at 17:47
1
Have you tried the--content-disposition
option?
â Nick ODell
Jul 4 at 17:59
@Nick ODell, thank you! It works. Please move your comment to an answer so I can upvote it.
â Alex Poca
Jul 4 at 18:02
I also just found by chance the answer at unix.stackexchange.com/questions/394464/â¦. I completely missed it before.
â Alex Poca
Jul 4 at 18:05
Have you tried the
--trust-server-names
option?â ivanivan
Jul 4 at 17:42
Have you tried the
--trust-server-names
option?â ivanivan
Jul 4 at 17:42
Yes, @ivanivan, I tried it but got
read.X
anyway...â Alex Poca
Jul 4 at 17:47
Yes, @ivanivan, I tried it but got
read.X
anyway...â Alex Poca
Jul 4 at 17:47
1
1
Have you tried the
--content-disposition
option?â Nick ODell
Jul 4 at 17:59
Have you tried the
--content-disposition
option?â Nick ODell
Jul 4 at 17:59
@Nick ODell, thank you! It works. Please move your comment to an answer so I can upvote it.
â Alex Poca
Jul 4 at 18:02
@Nick ODell, thank you! It works. Please move your comment to an answer so I can upvote it.
â Alex Poca
Jul 4 at 18:02
I also just found by chance the answer at unix.stackexchange.com/questions/394464/â¦. I completely missed it before.
â Alex Poca
Jul 4 at 18:05
I also just found by chance the answer at unix.stackexchange.com/questions/394464/â¦. I completely missed it before.
â Alex Poca
Jul 4 at 18:05
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Use wget --content-disposition <url>
Explanation: The Content-Disposition header can be used by a server to suggest a filename for a downloaded file. By default, wget uses the last part of the URL as the filename, but you can override this with --content-disposition
, which uses the server's suggested name.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Use wget --content-disposition <url>
Explanation: The Content-Disposition header can be used by a server to suggest a filename for a downloaded file. By default, wget uses the last part of the URL as the filename, but you can override this with --content-disposition
, which uses the server's suggested name.
add a comment |Â
up vote
2
down vote
accepted
Use wget --content-disposition <url>
Explanation: The Content-Disposition header can be used by a server to suggest a filename for a downloaded file. By default, wget uses the last part of the URL as the filename, but you can override this with --content-disposition
, which uses the server's suggested name.
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Use wget --content-disposition <url>
Explanation: The Content-Disposition header can be used by a server to suggest a filename for a downloaded file. By default, wget uses the last part of the URL as the filename, but you can override this with --content-disposition
, which uses the server's suggested name.
Use wget --content-disposition <url>
Explanation: The Content-Disposition header can be used by a server to suggest a filename for a downloaded file. By default, wget uses the last part of the URL as the filename, but you can override this with --content-disposition
, which uses the server's suggested name.
answered Jul 4 at 18:07
Nick ODell
8922819
8922819
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f453465%2fwget-how-to-download-a-served-file-keeping-its-name%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Have you tried the
--trust-server-names
option?â ivanivan
Jul 4 at 17:42
Yes, @ivanivan, I tried it but got
read.X
anyway...â Alex Poca
Jul 4 at 17:47
1
Have you tried the
--content-disposition
option?â Nick ODell
Jul 4 at 17:59
@Nick ODell, thank you! It works. Please move your comment to an answer so I can upvote it.
â Alex Poca
Jul 4 at 18:02
I also just found by chance the answer at unix.stackexchange.com/questions/394464/â¦. I completely missed it before.
â Alex Poca
Jul 4 at 18:05