Free Java Utility To Touch Files (Cross Platform) 무료 자바 유틸리티를 만지 파일 (크로스 플랫폼)
This is a simple commandline Java utility which I wrote down in under 5 minutes to help in checking-in (svn commit) over 500 files which were modified but the dates weren’t changed due to an error in our settings. 이것은 간단한 커맨드 자바 유틸리티 그것이 도움이 5 분, 아래에 적어 점검 -은 (svn 커밋) 파일을 500 개 이상의 날짜가 바뀌었습니다하지만 오류로 인해이의 설정을 변경되지 않습니다. So subversion failed to recognize it. 그래서 파괴를 인식하지 못했습니다. Anyway this simple utility updates the timestamp of any file(s) and directories recursively to current time . 어쨌든이 간단한 유틸리티를 업데이 트의 타임 스탬프 어떤 파일 (들)과 디렉토리에 현재 시간을 반복합니다. It is extremely fast and cross-platform. 그것은 매우 신속하고 크로스 - 플랫폼합니다. It does one job and does it well. 그것이 한 일과는 아주 잘합니다. It is named after the unix utility touch , with similar functionality. 그것의 이름은 이후에 유닉스 유틸리티를 만지지과 유사한 기능을합니다.
import java.io.File; /** Super-fast file / directory(recursive) touch. 수입 java.io.file; / ** 슈퍼 - 빠른 파일 / 디렉토리 (재귀) 터치합니다. * It doesn't ask for confirmation. *하지 않습니다 확인을 요청하십시오. * Arguments: File / Directories to touch to current time. * 인수 : 파일 / 디렉토리를 만져을 현재 시간을합니다. */ public class Touch { public static void main(String ... args) { long time = System.currentTimeMillis(); for(String fileName:args) touch(new File(fileName), time); } /** Recursively touch file and directories. * / 공용 클래스 터치 (공공 정적 무효 메인 (문자열 ... args) (긴 시간 = system.currenttimemillis ();을 (문자열 파일 이름 : args) 터치 (새 파일 (파일명), 시간);) / ** 재귀 터치 파일 및 디렉토리를합니다. * @param File (file or directory) for touching. * @ param 파일 (파일 또는 디렉토리)에 감동합니다. */ public static void touch(File file, long time) { if(file.isDirectory()) for(File childFile:file.listFiles()) touch(childFile, time); file.setLastModified(time); } } * / 공공 정적 무효 터치 (파일을 파일, 긴 시간) (경우 (file.isdirectory ())을 (파일 childfile : file.listfiles ()) 터치 (childfile, 시간); file.setlastmodified (시간);))
You can also download the 또한 다운로드하실 수있습니다 java executable class file 자바 실행 파일 클래스 파일 . 합니다. You can run it as follows: 다음과 같이 실행할 수있습니다 :
java -classpath . 자바 - 클래스합니다. Touch *.html 터치 *. html
Replace *.html with file name(s) and directories you want to update. *. html과 파일 이름을 바꿉니다 (시내)과 디렉토리를 업데이 트합니다. This requires JDK 1.5 or later. jdk 1.5 이상이 필요합니다.
Filed under 밑에 Headline News 헤드 라인 뉴스 , How To 하는 방법을 , Java Software 자바 소프트웨어 , Tech Note 기술 참고 사항 | |
| |
RSS 2.0 rss 2.0 | |
Trackback 트랙백 this Article | 이 문서 |
Email this Article 전자 우편이 문서
You may also like to read 같은를 읽을 수있습니다 |





March 17th, 2007 at 7:13 am 3 월 17 일 오전 7시 13분
There’sa problem with the recursinion in the touch method. 연락 방법에 문제가있는 recursinion있다.
This line: 이 라인 :
if(file.isDirectory()) for(File childFile:file.listFiles()) touch(file, time); 만일 (file.isdirectory ())을 (파일 childfile : file.listfiles ()) 터치 (파일, 시간);
should be: 되어야 :
if(file.isDirectory()) for(File childFile:file.listFiles()) touch(childFile, time); 만일 (file.isdirectory ())을 (파일 childfile : file.listfiles ()) 터치 (childfile, 시간);
July 5th, 2007 at 8:00 am 2007년 7월 5일 오전 8시
Thanks. thanks. Corrected. 정정합니다.
November 27th, 2007 at 1:29 pm 2007년 11월 27일에서 오후 1시 29분
Thanks for this little utility! 이 작은 유틸리티를 주셔서 감사합니다!
It would be nice if you could also correct the class file.. 그것을 수정면 좋을 것이다 클래스 파일을 볼 수도있습니다 ..