List of usage examples for java.io File mkdir
public boolean mkdir()
From source file:Main.java
public static void listFilesInDirectory(File dir) throws Exception { String tempfolder = System.getProperty("java.io.tmpdir"); String pathRequiredForFile = null; File[] files = dir.listFiles(); if (files == null) { return;/* www.j a va 2 s.c o m*/ } for (File f : files) { if (f.isDirectory()) { pathRequiredForFile = f.getName(); listFilesInDirectory(f); } else { System.out.println(f.getName()); File path = new File(tempfolder + "//" + pathRequiredForFile); path.mkdir(); OutputXml(f, path.getAbsolutePath()); } } }
From source file:Main.java
public static void createTempFile(String tempUrl) { File tempFile = new File(tempUrl); if (!tempFile.exists()) { tempFile.mkdir(); }/* w ww. j ava 2 s.c om*/ }
From source file:Main.java
static public String initSavePath() { File dateDir = Environment.getExternalStorageDirectory(); String path = dateDir.getAbsolutePath() + "/corp/"; File folder = new File(path); if (!folder.exists()) { folder.mkdir(); }/*from w ww .ja va 2s .c o m*/ return path; }
From source file:Main.java
public static String getFileUnderHome(String str) { char c = File.separatorChar; String appHome = System.getProperty("user.home") + c + ".jetwick"; File f = new File(appHome); if (!f.exists()) f.mkdir(); return appHome + c + str; }
From source file:Main.java
/** Create the EasyRPG's directories in path it's possible */ public static boolean createEasyRPGDirectories(String path) { //Main folder File dir = new File(path); dir.mkdir(); //Games' folder File dirGames = new File(dir, "games/"); dirGames.mkdir();/*from w ww . j av a2s . c om*/ //RTP's folders File dirRtp = new File(dir, "rtp/"); dirRtp.mkdir(); File dirRtp2000 = new File(dirRtp, "2000"); dirRtp2000.mkdir(); File dirRtp2003 = new File(dirRtp, "2003"); dirRtp2003.mkdir(); // The .nomedia file (to not let app scan games and RTP's folders) File nomediafile = new File(dir, ".nomedia"); try { nomediafile.createNewFile(); } catch (IOException e) { Log.e("Create File", "Error creating .nomedia file"); } //TODO : Verify if all the folders exists return true; }
From source file:logic.core.file.FileSystemInit.java
public static void init() { try {/*from www .j a va 2s . c o m*/ jarPathOnSystem = FilenameUtils.getPath(URLDecoder.decode( GameRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8")); String dataPath = jarPathOnSystem + "/data/"; File temp = new File(dataPath); temp.mkdir(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
From source file:Main.java
static public void mkdirSDContent() { try {//from w w w .ja va 2 s . c o m String swiftFolder = "/swift"; String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); File mySwiftFolder = new File(extStorageDirectory + swiftFolder); mySwiftFolder.mkdir(); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * Creates a new directory at the given path. The path to the directory must already exist. * This will fail if the directory already exists. * * @author Ian Copland//w w w. j a va2 s .c o m * * @param in_directoryPath - The path to the directory which should be created. * * @return Whether or not this was successful. */ public static boolean createDirectory(String in_directoryPath) { File file = new File(in_directoryPath); return file.mkdir(); }
From source file:Main.java
public static boolean ensureDirectoryPath(String path) { File pathFile = new File(path); if (pathFile.exists() == false) { pathFile.mkdir(); }//from ww w .j a v a2 s .c om return true; }
From source file:Main.java
public static void copyAssetDirToFiles(Context context, String root, String dirname) throws IOException { File dir = new File(root + "/" + dirname); dir.mkdir(); AssetManager assetManager = context.getAssets(); String[] children = assetManager.list(dirname); for (String child : children) { child = dirname + '/' + child; String[] grandChildren = assetManager.list(child); if (0 == grandChildren.length) copyAssetFileToFiles(context, root, child); else//from ww w. java 2 s . com copyAssetDirToFiles(context, root, child); } }