distinguish between files and directories @returns {Object} contains directories and files array
421207
function distinguishPaths(paths) {
    paths = Array.isArray(paths) ? paths : [paths];
    var result = {
      directories: [],
      files: []
    };
    paths.forEach(function(name) {
      if (fs.statSync(name).isDirectory()) {
        result.directories.push(name);
      } else {
        result.files.push(name);
      }
    });
    return result;
  }
1299167
function dirsExist(dirs) {
  if (0 === dirs.length) {
    return new Promise((resolve) => {
      resolve({});
    });
  }

  // Group dirs by '/' count
  const dirsByDepth = dirs.reduce(function(prev, curItem) {
    const depth = curItem.split(path.sep).length;
    (prev[depth] = prev[depth] || []).push(curItem);

    return prev;
  }, {});

  // Extract min depth dirs
  const allDepths = Object.keys(dirsByDepth).map(Number);
  const currDepth = Math.min(...allDepths);
  const currDirs = dirsByDepth[currDepth];

  // Prepare result object
  const result = dirs.reduce(function(prev, item) {
    prev[item] = null;

    return prev;
  }, {});

  // Check if min depth dirs exist
  return stupidDirsExist(currDirs).then((localResult) => {
    Object.keys(result).forEach((dir) => {
      if (null !== result[dir]) {
        return;
      }

      Object.keys(localResult).forEach((localDir) => {
        // Transfer local check result to global "as is"
        result[localDir] = localResult[localDir];

        // Additionally check if we can mark more deeper directories
        // as non-existing
        if (false === localResult[localDir] &&
          dir.slice(0, localDir.length + 1) === localDir + path.sep) {
          result[dir] = false;
        }
      });
    });

    // Extract not checked dirs
    const restDirs = dirs.filter((dir) => {
      return null === result[dir];
    });

    return dirsExist(restDirs);
  }).then((finalResult) => {
    // Transfer local check result to global "as is"
    Object.keys(finalResult).forEach((finalDir) => {
      result[finalDir] = finalResult[finalDir];
    });

    return result;
  });
}
375555
function isDirectory(filePath) {
  if (!isExist(filePath)) return false;
  try {
    const stat = fs.statSync(filePath);
    return stat.isDirectory();
  } catch (e) {
    return false;
  }
}
989769
function checkForChangedFolders(dir) {
    var fileList = fs.readdirSync(dir);
    for (var i = 0; i < fileList.length; i++) {
        if (!fs.existsSync(dir+fileList[i])) { continue; }
        var dirStat;
        try {
            dirStat = fs.statSync(dir + fileList[i]);
        } catch (e) {
            // This means the file disappeared between the exists and us stating the file.
            continue;
        }
        if (dirStat.isDirectory()) {
            if (!watchingFolders[dir + fileList[i]]) {
                console.log("Adding new directory to watch: ", dir + fileList[i]);
                setupWatchers(dir + fileList[i]);
            }
        }
    }
}
126952
function getAllFolders(dir, folderlist) {
    const files = fs.readdirSync(dir);
    folderlist = folderlist || [];
    files.forEach((file) => {
        if (fs.statSync(path.join(dir, file)).isDirectory()) {
            folderlist = getAllFolders(path.join(dir, file), folderlist);
            folderlist.push(path.join(dir, file));
        }
    });
    return folderlist;
}
944735
function(dir) {
      var results = [];

      var list = fs.readdirSync(dir);

      list.forEach(function(file) {
        // Check for every given pattern, regardless of whether it is an array or a string
        var matchesSomeExclude = [].concat(options.exclude).some(function(regexp) {
          return file.match(regexp) != null;
        });

        if(!matchesSomeExclude) {
          var matchesSomePattern = [].concat(options.match).some(function(regexp) {
            return file.match(regexp) != null;
          });

          file = path.resolve(dir, file);
          var stat = fs.statSync(file);

          if (stat && stat.isDirectory()) {
            if(matchesSomePattern) {
              results = results.concat(file);
            }
            results = results.concat(walk(file));
          }
        }
      });

      return results;
    }
9011
function (data) {
                if (data.result && $.isArray(data.result.files)) {
                    return data.result.files;
                }
                return [];
            }
1057891
function checkForChangedFiles(dir) {
    var fileList = fs.readdirSync(dir);
    for (var i=0;i<fileList.length;i++) {
        if (!isWatching(fileList[i])) {
            continue;
        }
        if (!fs.existsSync(dir+fileList[i])) { continue; }
        var stats;
        try {
            stats = fs.statSync(dir + fileList[i]);
        }
        catch (err) {
            // this means the file disappeared between the exists and when we tried to stat it...
            continue;
        }
        if (timeStamps[dir+fileList[i]] === undefined || timeStamps[dir+fileList[i]] !== stats.mtime.getTime()) {
            //console.log("Found 1: ", dir+fileList[i], timeStamps[dir+fileList[i]], stats.mtime.getTime());

            timeStamps[dir+fileList[i]] = stats.mtime.getTime();
            return dir+fileList[i];
        }
    }
    return null;
}
1136905
function ( files ) {
        var me = this;
        files = files || [ ];

        return me.normalizeEntries( files ).filter( function ( entry ) {
          return entry.changed;
        } ).map( function ( entry ) {
          return entry.key;
        } );
      }
828640
function filterFiles(files, recursive) {
    var fileOrDir = function fileOrDir(lstat) {
        return lstat.isFile() || lstat.isDirectory();
    };
    return files.filter(function (_ref) {
        var lstat = _ref.lstat;

        return recursive ? fileOrDir(lstat) : lstat.isFile();
    });
}
1330064
function(/* Array */ files) {

                    var preprocessor;

                    if (_.isEmpty(files)) {
                        return preprocessor;
                    }

                    // collect all the possible extensions
                    // and remove duplicates
                    files = _.chain(files).map(function (/* string */ file) {

                        var ext = path.extname(file).split('.');

                        return ext[ext.length - 1];

                    }).uniq().value();

                    preprocessor = _.find(Object.keys(plugin.preprocessors), function (/* String */ key) {

                        var value = plugin.preprocessors[key],
                            exts = value.split(/[,\s]+/),

                            matches = _.filter(files, function (/* String */ ext) {
                                return exts.indexOf(ext) !== -1;
                            });

                        return !_.isEmpty(matches);

                    });

                    return preprocessor;

                }
1214659
def DirContains(self,f) :
        
        def match(fsNode) :
            if not fsNode.isdir() : return False 
            for c in fsNode.children() :
                if f(c) : return True
            return False
        return self.make_return(match)
710993
function _getFirstDirectory(dir) {
  var files = glob.sync(dir + '/*');

  for (var i = files.length; i--; ) {
    var file = files[i];
    if (fs.statSync(file).isDirectory()) return file;
  }

  return false;
}
18524
function checkMissingDir(destinationFile) {
  var filePath = path.dirname(destinationFile);
  var pathAbsolute = path.isAbsolute(filePath);
  var directories = filePath.split(path.sep);
  return transversePath(directories);
}
615970
function getFiles(base, dir = '', results = []) {
            const files = fs.readdirSync(path.join(base, dir));
            for (const file of files) {
                const relativeToBase = path.join(dir, file);
                if (fs.statSync(path.join(base, relativeToBase)).isDirectory()) {
                    getFiles(base, relativeToBase, results);
                } else {
                    results.push(relativeToBase);
                }
            }
            return results;
        }
904616
function isValidDir(dir) {
    var fs = require("fs");
    try {
        return fs.statSync(dir).isDirectory();
    } catch (err) {
        return false;
    }
}
323444
function getDirectories (basePath, includeFiles, userSuppliedFilterFn) {

  var items;
  try {
    items = fs.readdirSync(basePath);
  }
  catch (err) {

    // probably a file not a dir, but let's check error message to be sure
    if (includeFiles && String(err.stack).match(/ENOTDIR/)) {
      return [ basePath ];
    }

    // something is wrong, perhaps directory read permissions problem
    // maybe throw err instead
    console.error(err.stack);
    return [];
  }

  return items.filter(function (file) {

    var absPath = path.join(basePath, file);

    var stats = fs.lstatSync(absPath);
    if (stats.isSymbolicLink()) {
      return false;
    }

    var isDir = includeFiles ? true : stats.isDirectory();
    var isNotDotFile = path.basename(file).indexOf('.') !== 0;
    return isDir && isNotDotFile && (userSuppliedFilterFn || allOK)(absPath);

  })
  .map(function (item) {
    // return path.join(basePath, item);
    return item;
  })
  .sort();
}