2017.09.02 11:20
Wget 제공되는 파일명으로 다운로드
조회 수 1187 추천 수 0 댓글 0
1 개요[편집]
- wget 제공되는 파일명으로 다운로드
- wget 파일명 헤더로부터 받기
--content-disposition
옵션을 붙이면 된다.
wget --content-disposition 'URL주소'
wget 'URL주소' --content-disposition
2 실습[편집]
- 그냥 wget 으로 받으면, URL 끝부분인
download1.php
로 받아짐
root@zetawiki:~# wget http://example.zetawiki.com/php/download1.php
... (생략)
100%[=================================================>] 12 --.-K/s in 0s
2016-10-07 18:15:32 (1.94 MB/s) - ‘download1.php’ saved [12/12]
--content-disposition
옵션을 붙이면, 서버에서 제공하는 파일명인hello_world.txt
로 받아짐
root@zetawiki:~# wget http://example.zetawiki.com/php/download1.php --content-disposition
... (생략)
100%[=================================================>] 12 --.-K/s in 0s
2016-10-07 18:15:38 (2.23 MB/s) - ‘hello_world.txt’ saved [12/12]
- curl 로 제공되는 파일명을 확인할 수도 있음
root@zetawiki:~# curl -Is http://example.zetawiki.com/php/download1.php | grep Content-Disposition
Content-Disposition: attachment; filename="hello_world.txt"