Java implements recursive search files

xiaoxiao2021-03-06  96

Use Java recursive search file import java.io. *;

Class filefind {static void getdir (string strpath) throws exception {type {file f = new file (strpath); if (f.IsDirectory ()) {file [] flist = f.listfiles (); for (int J = 0 ; j

IF (flist [j] .isfile ()) {system.out.println (flist [j] .getpath ());

}}} Catch (Exception E) {system.out.println ("Error:" E);}} public static void main (string "args) {string strpath =" e: // CQQ "; system.out .println (strpath);

Try {getDir (STRPATH);} catch (exception e) {}}}

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

New Post(0)