import java.io.*;
public class ListeRep {
public static void main(String[] args) throws FileNotFoundException {
if (args.length==0) {
listeRep(".");
} else {
for (int i=0; i<args.length; i++) {
listeRep(args[i]);
}
}
}
public static void listeRep(String nom) throws FileNotFoundException {
File f = new File(nom);
if (!f.exists() || !f.isDirectory()) {
throw new FileNotFoundException();
}
File[] ls = f.listFiles();
for (int i=0; i<ls.length; i++) {
File file = ls[i];
System.out.print(file.isDirectory()?"d":"-");
System.out.print(file.canRead()?"r":"-");
System.out.print(file.canWrite()?"w\t":"-\t");
System.out.print(file.length());
System.out.print("\t");
System.out.println(file.getName());
}
}
}