Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- /** nrikee.wordpress.com */
- public class ls
- {
- public static void main(String args[]){
- String nom;
- if(args.length==0) nom = ".";
- else nom = args[0];
- File f = new File(nom);
- if( f.exists() ) {
- if ( !f.isDirectory() ) System.out.println("Nom fitxer: " +f.getName()+ "\nTamany: " + f.length() );
- else {
- File[] fitxers = f.listFiles();
- System.out.println("Nom\t\tTamany");
- for (int a=0; a<fitxers.length; a++)
- System.out.println( fitxers[a].getName()+ "\t" + fitxers[a].length() );
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement