"Wget 제공되는 파일명으로 다운로드"의 두 판 사이의 차이

 
(사용자 2명의 중간 판 5개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
{{소문자}}
;wget 제공되는 파일명으로 다운로드
;wget 제공되는 파일명으로 다운로드
;wget 파일명 헤더로부터 받기
;wget 파일명 헤더로부터 받기
* <code>--content-disposition</code> 옵션을 붙이면 된다.
<source lang='bash'>
<source lang='bash'>
wget --content-disposition 'URL주소'
wget --content-disposition 'URL주소'
18번째 줄: 20번째 줄:
2016-10-07 18:15:32 (1.94 MB/s) - ‘download1.php’ saved [12/12]
2016-10-07 18:15:32 (1.94 MB/s) - ‘download1.php’ saved [12/12]
</source>
</source>
* <code>--content-disposition</code> 옵션을 붙이면, 서버에서 제공하는 파일명([[Content-Disposition]])인 <code>hello_world.txt</code>로 받아짐
* <code>--content-disposition</code> 옵션을 붙이면, 서버에서 제공하는 파일명인 <code>hello_world.txt</code>로 받아짐
<source lang='console'>
<source lang='console'>
root@zetawiki:~# wget http://example.zetawiki.com/php/download1.php --content-disposition
root@zetawiki:~# wget http://example.zetawiki.com/php/download1.php --content-disposition
25번째 줄: 27번째 줄:


2016-10-07 18:15:38 (2.23 MB/s) - ‘hello_world.txt’ saved [12/12]
2016-10-07 18:15:38 (2.23 MB/s) - ‘hello_world.txt’ saved [12/12]
</source>
* curl 로 제공되는 파일명을 확인할 수도 있음
<source lang='console'>
root@zetawiki:~# curl -Is http://example.zetawiki.com/php/download1.php | grep Content-Disposition
Content-Disposition: attachment; filename="hello_world.txt"
</source>
</source>


==같이 보기==
==같이 보기==
* [[Content-Disposition]]
* [[리눅스 wget]]
* [[리눅스 wget]]


==참고 자료==
==참고==
*http://askubuntu.com/questions/77711/force-wget-to-use-actual-filename
*http://askubuntu.com/questions/77711/force-wget-to-use-actual-filename


[[분류: 리눅스]]
[[분류: 리눅스]]

2020년 6월 4일 (목) 16:13 기준 최신판

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"

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}