|
@ -8,7 +8,7 @@ public class Util { |
|
|
File f = new File(path); |
|
|
File f = new File(path); |
|
|
if(f.isDirectory()) { |
|
|
if(f.isDirectory()) { |
|
|
System.out.println(f.getAbsolutePath()); |
|
|
System.out.println(f.getAbsolutePath()); |
|
|
listItems(f); |
|
|
|
|
|
|
|
|
listItemsArgs(f); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -18,4 +18,24 @@ public class Util { |
|
|
System.out.println(i); |
|
|
System.out.println(i); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
public static void listItemsArgs(File f){ |
|
|
|
|
|
File[] items = f.listFiles(); |
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
for(File i : items) { |
|
|
|
|
|
if(i.isDirectory()) { |
|
|
|
|
|
sb.append("d"); |
|
|
|
|
|
} |
|
|
|
|
|
if(i.canRead()) { |
|
|
|
|
|
sb.append("-r"); |
|
|
|
|
|
} |
|
|
|
|
|
if(i.canWrite()) { |
|
|
|
|
|
sb.append("-w"); |
|
|
|
|
|
} |
|
|
|
|
|
if(i.canExecute()) { |
|
|
|
|
|
sb.append("-x"); |
|
|
|
|
|
} |
|
|
|
|
|
System.out.printf("%s %s\n", sb.toString(), i.getName()); |
|
|
|
|
|
sb.setLength(0); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |