返回列表 發帖
  1. package bbs.istak.org.tw;

  2. import java.io.File;
  3. import java.io.IOException;


  4. public class main {
  5.         private static int number;
  6.         private static File f;
  7.         public static void main(String args[]) throws IOException

  8.         {
  9.                 f = new File("D:\\a\\b\\c\\Test.txt");
  10.                 String str[] = f.list();
  11.                 String path = f.getPath();

  12.                 File file =S(path);                        

  13.         }
  14.         public static File S(String path)
  15.         {
  16.                 if(!f.exists())
  17.                 {
  18.                         if(number==0)
  19.                         {
  20.                                 f.getParentFile().mkdirs();
  21.                                 try {
  22.                                         f.createNewFile();
  23.                                 } catch (IOException e) {
  24.                                         e.printStackTrace();
  25.                                 }
  26.                         }        
  27.                         return S(f.getPath());
  28.                 }else
  29.                 {
  30.                         return f;
  31.                 }
  32.         }
複製代碼

TOP

返回列表