DBA Data[Home] [Help]

JAVA SOURCE: SYS.Upgrdcreatedir

Source


1 import java.lang.*;
2             import java.util.*;
3             import java.io.*;
4 
5             public class Upgrdcreatedir
6             {
7               public static int create (String path)
8               {
9                 File myFile = new File(path);
10                 if (myFile.exists())
11                 {
12                   if (myFile.canWrite())
13                     return 1;  /* Directory exists and is writable, OK */
14                   else
15                     return 2;  /* Directory exists and is not writable, NOT OK */
16                 }
17                 else
18                 {
19                   if (myFile.mkdirs())
20                     return 1;  /* Directory created, OK */
21                   else
22                     return 4;  /* Directory could not be created, NOT OK */
23                 }
24               }
25             }