Java tutorial
//package com.java2s; import java.io.File; public class Main { public static File getFilePath(String filePath, String fileName) { File file = null; makeRootDirectory(filePath); try { file = new File(filePath + fileName); if (!file.exists()) { file.createNewFile(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return file; } public static void makeRootDirectory(String filePath) { File file = null; try { file = new File(filePath); if (!file.exists()) { file.mkdirs(); } } catch (Exception e) { } } }