2011-03-14 3 views

답변

1

빈 파일을 만들고 원래 파일 + 빈 파일을 원래 파일로 다시 복사하십시오. 방금 Windows에서 테스트했고 효과가있었습니다.

 
C:\tmp>dir \utils\emp* 
Volume in drive C has no label. 
Volume Serial Number is BC80-0D15 

Directory of C:\utils 

2011-03-14 11:58     0 empty_file 
       1 File(s)    0 bytes 
       0 Dir(s) 27,506,368,512 bytes free 

C:\tmp>dir *.gif 
Volume in drive C has no label. 
Volume Serial Number is BC80-0D15 

Directory of C:\tmp 

2010-10-08 12:00   20,463 cknight.gif 
2009-10-30 17:31   1,298,525 img-big.gif 
2009-10-30 17:46   225,992 img.gif 
       3 File(s)  1,544,980 bytes 
       0 Dir(s) 27,506,368,512 bytes free 

C:\tmp>copy /b img.gif+\Utils\empty_file /b img.gif 
img.gif 
\Utils\empty_file 
     1 file(s) copied. 

C:\tmp>dir *.gif 
Volume in drive C has no label. 
Volume Serial Number is BC80-0D15 

Directory of C:\tmp 

2010-10-08 12:00   20,463 cknight.gif 
2009-10-30 17:31   1,298,525 img-big.gif 
2011-03-14 12:07   225,992 img.gif 
       3 File(s)  1,544,980 bytes 
       0 Dir(s) 27,506,368,512 bytes free 

C:\tmp> 
+1

인자없이'touch'를 실행하면, 마지막 수정 된 타임 스탬프를 수정한다고 생각합니다. 이게 내가 한 일이야. – Geo

+0

@geo : 가능한 해결책으로 내 대답을 편집했습니다. – maraguida

1

touch는 아주 간단한 프로그램입니다. 필수 단계를 쉽게 추출하여 시스템의 서브 루틴으로 구현할 수 있습니다. the source code을 참조하십시오.

터치는 utime()에 의존하며 POSIX이며 대부분의 플랫폼에서 사용할 수 있어야합니다.

또는 스크립트에서 호출해야하는 경우 실행 파일로 직접 터치 구현을 제공 할 수도 있습니다.

관련 문제