Java, dizin/dosya oluşturmak ve silme işlemlerini File sınıfı kullanılarak gerçekleştirilen metotlar.
Dizin Oluştur
1 2 3 4 5 6 7 8 9 | public void setDirectory(String directory) { try { File dir = new File(directory); if (!dir.exists()) { dir.mkdir(); } } catch (Exception e) { } } |
Dosya Oluştur
1 2 3 4 5 6 7 8 9 | public void setFile(String path) { try { File file = new File(path); if (!file.exists()) { file.mkdir(); } } catch (Exception e) { } } |
Dosya Sil
1 2 3 4 5 6 7 8 | public void delFile(String path) { try { File file = new File(path); if (!file.exists()) { file.delete(); } } catch (Exception e) { } |