List All in the Directory

xiaoxiao2021-03-05  29

/ * * CREATED ON 2005-4-8 * * Todo to change the Template for this generated file go to * window - preferences - java - code style - code templates * / package c12;

Import java.io.file;

/ ** * @author zhang * * Todo to change Type Comment GO WINDOW - * Preferences - Java - Code Style - Code Templates * / Public class listdir {

Private stringbuffer list = new stringbuffer ();

Private static boolean disp_dir = false;

Private static void listdir (file file) {string [] list; string absolutionpath; absolutionpath = file.getabsolutePath (); list = file.list (); for (int i = 0; i

} else {system.out.println (Temp.getabsolutePath ());}}}

Private static void usage () {system.out.println ("USAGE: DIRLIST DIRECTORY ... / N" "");}

Public static void main (string [] args) {string path = NULL; if (args.length == 0) {usage (); system.exit (1);} if (args.length == 1) {path = Args [0];} if (args.length == 2) {IF (args [0] .Equalsignorecase ("- d")) listdir.disp_dir = true; path = args [1];} try {file file = New file (path); Listdir (file);} catch (nullpointerexception npe) {npe.printStackTrace (); system.out.println ("error: folder does not exist !!!");}}}

转载请注明原文地址:https://www.9cbs.com/read-34217.html

New Post(0)