Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- /**
- * Write a description of class consola here.
- *
- * @author nRikee93 (Twitter)
- * @version (a version number or a date)
- */
- public class ls
- {
- public static void main(String[] args){
- File f = new File(args[0]);
- 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