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); } 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.mkdir(); } } catch (Exception e) { } } }