Java mkdir makeDirs(String fileName, boolean hasFile)

Here you can find the source of makeDirs(String fileName, boolean hasFile)

Description

make Dirs

License

Apache License

Declaration

public static boolean makeDirs(String fileName, boolean hasFile) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    public static boolean makeDirs(String fileName, boolean hasFile) {
        boolean result = false;
        if (hasFile) {
            int lastIndex = fileName.lastIndexOf('/');
            if (lastIndex > -1) {
                String filePath = fileName.substring(0, lastIndex);
                if (filePath != null && !filePath.equals("")) {
                    result = new File(filePath).mkdirs();
                }// w w  w  . jav  a2s.com
            }
        } else {
            result = new File(fileName).mkdirs();
        }
        return result;
    }
}

Related

  1. makeDirs(File file)
  2. makeDirs(final File file)
  3. makeDirs(String dir)
  4. makeDirs(String fileName)
  5. makedirs(String fileName)
  6. makeDirs(String filePath)
  7. makeDirs(String strBottomFoldName, String strFoldName)
  8. makeDIRS(String[] dirs, File path)
  9. makeDirsFor(File file)