사용자 도구

사이트 도구


groovy:file

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
groovy:file [2013/05/17 14:30]
kwon37xi
groovy:file [2013/05/17 14:47]
kwon37xi [파일 이름]
줄 4: 줄 4:
   * [[http://docs.oracle.com/javase/6/docs/api/java/io/File.html|File Java 6]]   * [[http://docs.oracle.com/javase/6/docs/api/java/io/File.html|File Java 6]]
  
 +===== 파일 이름 =====
 +  * [[http://stackoverflow.com/questions/1569547/does-groovy-have-an-easy-way-to-get-a-filename-without-the-extension|파일 이름에서 확장자 빼고 이름만]]<code groovy>
 +file.name.replaceFirst(~/\.[^\.]+$/, '')
 +</code>
 ===== 텍스트 파일 ===== ===== 텍스트 파일 =====
 <code groovy> <code groovy>
줄 34: 줄 38:
 List movies = filesbyExt('avi') List movies = filesbyExt('avi')
 </code> </code>
-  * Groovy 스럽게 바꾸면 [[[[http://www.groovycode.com/file/filename_filter|groovycode.com : file : filter files with the filenamefilter]] <code groovy>+  * Groovy 스럽게 바꾸면 [[http://www.groovycode.com/file/filename_filter|groovycode.com : file : filter files with the filenamefilter]] <code groovy>
 def filesByExt(ext) { def filesByExt(ext) {
     new File('.').listFiles({file, filename -> filename.endsWith('.' + ext)} as FilenameFilter)     new File('.').listFiles({file, filename -> filename.endsWith('.' + ext)} as FilenameFilter)
 } }
 </code> </code>
groovy/file.txt · 마지막으로 수정됨: 2019/03/07 11:15 저자 kwon37xi