Returns the child dirs if any, otherwise return new File[0]
@param file
@return
427262
public static File [] listDirs(File file) {
		if (file==null){
			return EMPTY_FILE_LIST;
		} 
		
		File ret[]=file.listFiles(DIR_FILTER);
		
		if (ret==null){
			return EMPTY_FILE_LIST;
		} else {
			return ret;
		}		
	}
645391
function makeDir(file) {
  return new Promise((resolve, reject) => {
    mkdirp(path.extname(file) ? path.dirname(file) : file, (err) => {
      if (err) reject(err);
      resolve();
    });
  });
}
378035
public static List<File> listFiles(File srcPath) throws IOException
   {
      List<File> result = new ArrayList<File>();

      if (!srcPath.isDirectory())
      {
         throw new IOException(srcPath.getAbsolutePath() + " is a directory");
      }

      for (File subFile : srcPath.listFiles())
      {
         result.add(subFile);
         if (subFile.isDirectory())
         {
            result.addAll(listFiles(subFile));
         }
      }

      return result;
   }
1329030
public static List<File> listDirs(final File dir)
	{
		final List<File> foundedDirs = new ArrayList<>();
		final File[] fileArray = dir.listFiles();
		for (final File element : fileArray)
		{
			if (element.isDirectory())
			{
				foundedDirs.add(element);
			}
		}
		return foundedDirs;

	}
1329570
public static void createFile(File file) throws Exception {
    File dir = new File(file.getAbsolutePath().replace(File.separator + file.getName(), ""));
    if(!dir.exists()) {
      if(!dir.mkdirs()) {
        throw new Exception("Can't create dirs "+dir);
      }
    }
    file.createNewFile();
  }
437802
public static synchronized Media get(File file)
    {
        Check.notNull(file);

        final String filename = file.getPath();
        final String localFile = filename.substring(resourcesDir.length() + filename.lastIndexOf(resourcesDir));

        return create(localFile);
    }
1101900
public static int recursiveDelete(File file) {
        int answer = 0;
        if (file.isDirectory()) {
            File[] files = file.listFiles();
            if (files != null) {
                for (File child : files) {
                    answer += recursiveDelete(child);
                }
            }
        }
        if (file.delete()) {
            answer += 1;
        }
        return answer;
    }
740289
public static void createParentDirectories(File file) {
		File parent = file.getParentFile();
		if (!parent.isDirectory()) {
			// Test the creation separately as there appears to be a race
			// condition that causes unit tests to sometimes fail.
			boolean created = parent.mkdirs();
			if (!created && !parent.isDirectory()) {
				throw new SystemException(MessageUtils.format(
						MSG_CANNOT_CREATE_OUTPUT_DIRECTORY,
						parent.getAbsolutePath()), parent);
			}
		}

	}
229204
public static boolean isInSubDirectory(File dir, File file)
    {
        if (file == null)
            return false;

        if (file.equals(dir))
            return true;

        return isInSubDirectory(dir, file.getParentFile());
    }
392609
List<File> getFiles() {
        List<File> list = new ArrayList<File>();
        for (String sDirectory : config.getDirectories()) {
            if (sDirectory != null) {
                File directory = getDirectory(sDirectory);
                File[] aFiles = directory.listFiles(config.getFilenameFilter());
                if (aFiles != null) {
                    list.addAll(Arrays.asList(aFiles));
                }
            }
        }
        return list;
    }
664667
public static URI createFolderURI(File file) {
		URI uri = URI.createFileURI(file.getAbsolutePath());
		return toFolderURI(uri);
	}
922843
public static ArrayList<File> getFilesInDirectoryTree(File file, String includeMask) {
		return getContentsInDirectoryTree(file, includeMask, true, false);
	}
647665
public static File getPathWithoutFilename(File file) {
        if (file != null) {
            if (file.isDirectory()) {
                // no file to be split off. Return everything
                return file;
            } else {
                String filename = file.getName();
                String filepath = file.getAbsolutePath();

                // Construct path without file name.
                String pathwithoutname = filepath.substring(0,
                        filepath.length() - filename.length());
                if (pathwithoutname.endsWith("/")) {
                    pathwithoutname = pathwithoutname.substring(0, pathwithoutname.length() - 1);
                }
                return new File(pathwithoutname);
            }
        }
        return null;
    }
440352
public ISO9660Directory addDirectory(File file) throws HandlerException {
        ISO9660Directory dir = new ISO9660Directory(file);
        return addDirectory(dir);
    }
457563
function File(file) {
  this.cache = new Map();
  this.history = [];
  this.pattern = file.pattern;
  this.recurse = file.recurse;
  this.dirname = file.dirname;
  this.segment = file.segment;
  this.path = file.path;
  this.orig = file.path;
}
124048
public static File createDirectoryTree( File file ) throws IOException
    {
        if (file.isDirectory() && file.canWrite()) return file;
        if (file.isDirectory())
            throw new IOException( "Directory not writable " + file.getAbsolutePath() );
        if (file.exists())
            throw new IOException( file.getAbsolutePath() + " is not a directory" );
        boolean created = file.mkdirs();
        if (!created) throw new IOException( "Could not create directory " + file.getAbsolutePath() );

        return file;
    }
491672
public VDirectory getDirectoryCreate(String name) {
		VDirectory child = new VDirectory(this, name);
		child.create();
		return child;
	}