Java file Search public void Getdir (String strpath) throws Exception {try {file F=new file (strpath);
if (F.isdirectory ()) {file[] flist=f.listfiles ();
for (int j=0;j<flist.length;j++) {if (Flist[j].isdirectory ()) {
System.out.println (Flist[j].getpath ()); Getdir (Flist[j].getpath ());
The Getdir function itself is called inside the Getdir function} for (int j=0;j<flist.length;j++) {if (Flist[j].isfile ()) {System.out.println (FL
Ist[j].getpath ())//change this to the statement you want to process. For example flist[j].substring (flist[j].length-3,3) = = "txt"}
A catch (Exception e) {e.printstacktrace ());
} Java file and folder copy file Fileold = new file (pathold);
File FileNew = new file (pathnew); if (Fileold.exiSTS ()) {try {FileInputStream FIS = new FileInputStream (fileold);
FileOutputStream fos = new FileOutputStream (filenew);
int read = 0;
while (read = Fis.read ())!=-1) {fos.write (read);
Fos.flush ();
} fos.close ();
Fis.close ();
catch (FileNotFoundException e) {e.printstacktrace ();
catch (IOException e) {e.printstacktrace ();
Java file Renaming file = new file ("D:\\123.txt");
if (file.exists ()) {File.renameto (New file ("D:\\1234.txt")); }