DirectoryAndFile.java
API description
public DirectoryAndFile()
public DirectoryAndFile(String getPath, boolean getTryCreateFlag)
- check directory exists (確認資料夾是否存在)
public int checkDirectoryExist()
public int checkDirectoryExist(String checkDirectoryPath, boolean tryToCreateIfNotExist)
- check local file exists (確認本地端檔案是否存在)
public int checkFileExist()
public int checkFileExist(String getCheckFilePath, boolean tryToCreateIfNotExist)
API example
- Example.1 : check a folder but not to create one if it is not existing
DirectoryAndFile df = new DirectoryAndFile("C:/Users/user/Desktop/demo",false);
System.out.println(String.format("%d", df.checkDirectoryExist()));
- Example.2 : check a file and try to create one if it is not existing
DirectoryAndFile df = new DirectoryAndFile();
System.out.println(String.format("%d", df.checkFileExist("C:/Users/user/Desktop/text.txt",true)));