Search This Blog

Java: create a new file also its parent directories as required

File file = new File("/tmp/a/b/c/1.txt");
file.getParentFile().mkdirs();
file.createNewFile();

No comments:

Post a Comment