⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 finddirectories.java

📁 Java编程例子(全新)演示基础的Java 功能,例如类,对象的使用,过程的调用,.
💻 JAVA
字号:
/**
   @version 1.00 05 Sep 1997
   @author Gary Cornell
*/

import java.io.*;

public class FindDirectories
{  
   public static void main(String[] args)
   {
      // if no arguments provided, start at the parent directory
      if (args.length == 0) args = new String[] { ".." };

      try
      {  
         File pathName = new File(args[0]);
         String[] fileNames = pathName.list();

         // enumerate all files in the directory
         for (int i = 0; i < fileNames.length; i++)
         {  
            File f = new File(pathName.getPath(), fileNames[i]);

            // if the file is again a directory, call the main method recursively
            if (f.isDirectory())
            {  
               System.out.println(f.getCanonicalPath());
               main(new String [] { f.getPath() });
            }
         }
      }
      catch(IOException e)
      {  
         e.printStackTrace(); 
      }
   }
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -