77import java .nio .file .attribute .FileTime ;
88import java .time .Instant ;
99import java .time .temporal .ChronoUnit ;
10+ import java .util .List ;
11+ import java .util .stream .Collectors ;
1012import java .util .stream .Stream ;
1113
1214// Files.walk example
@@ -30,7 +32,7 @@ public static void main(String[] args) throws IOException {
3032 }
3133
3234 // list all files from this path
33- /* public static List<Path> listFiles(Path path) throws IOException {
35+ public static List <Path > listFiles (Path path ) throws IOException {
3436
3537 List <Path > result ;
3638 //try (Stream<Path> walk = Files.walk(path, 1)) {
@@ -40,10 +42,10 @@ public static void main(String[] args) throws IOException {
4042 }
4143 return result ;
4244
43- }*/
45+ }
4446
4547 // list all directories from this path
46- /* public static List<Path> listDirectories(Path path) throws IOException {
48+ public static List <Path > listDirectories (Path path ) throws IOException {
4749
4850 List <Path > result ;
4951 try (Stream <Path > walk = Files .walk (path )) {
@@ -89,10 +91,10 @@ public static List<Path> findByFileName(Path path, String fileName) throws IOExc
8991 }
9092 return result ;
9193
92- }*/
94+ }
9395
9496 // fileSize in bytes
95- /* public static List<Path> findByFileSize(Path path, long fileSize) throws IOException {
97+ public static List <Path > findByFileSize (Path path , long fileSize ) throws IOException {
9698
9799 if (!Files .isDirectory (path )) {
98100 throw new IllegalArgumentException ("Path must be a directory!" );
@@ -121,7 +123,7 @@ private static boolean checkFileSize(Path path, long fileSize) {
121123 System .err .println ("Unable to get the file size of this file: " + path );
122124 }
123125 return result ;
124- }*/
126+ }
125127
126128 // set all files' last modified time to this instant
127129 public static void setAllFilesModifiedDate (Path path , Instant instant ) throws IOException {
0 commit comments