본문 바로가기
Infra/Linux

wget으로 파일 받을 때 파일 수정시간은?

by Tomining 2024. 9. 25.

wget으로 파일을 받으면 파일이 생성되는 것이니 파일 수정시간(mtime)은 다운로드 받은 시간으로 이해하고 있었는데, 기본값은 서버에서 내려주는 Last-modified 시간이다.

참고: https://cmd.inp.nsk.su/old/cmd2/manuals/gnudocs/gnudocs/wget/wget_17.html

 

The usage of time-stamping is simple. Say you would like to download a file so that it keeps its date of modification.

wget -S http://www.gnu.ai.mit.edu/
A simple ls -l shows that the time stamp on the local file equals the state of the Last-Modified header, as returned by the server. As you can see, the time-stamping info is preserved locally, even without `-N'.
Several days later, you would like Wget to check if the remote file has changed, and download it if it has.

wget -N http://www.gnu.ai.mit.edu/
Wget will ask the server for the last-modified date. If the local file is newer, the remote file will not be re-fetched. However, if the remote file is more recent, Wget will proceed fetching it normally.

 

  • -S : 서버에서 내려주는 Last-modified 시간
  • -N : local, server 중 좀 더 최신의 시간

 

서버 시간을 무시하고 다운로드 받은 시간으로 지정할 수는 없을까?

--no-use-server-timestamps     don't set the local file's timestamp by the one on the server.

 

위 옵션을 주면 다운받은 현재 시간으로 mtime이 설정된다.

 

'Infra > Linux' 카테고리의 다른 글

bash shell 로 날짜별 script 수행해보기  (0) 2018.01.23
비밀번호 없이 SSH를 통해 장비 접속하기  (0) 2016.01.08
Linux 파일 구조  (0) 2015.12.31
find exec 사용시 주의사항  (0) 2015.03.31
Find 명령어  (0) 2015.03.16