Borra este directorio y todo lo que haya dentro.
Si esto no es un directorio sale.

@param dir
@return
340640
public static boolean deleteDirRecursively(File dir) {
		if (!dir.exists() || !dir.isDirectory()) {
			// No hay ficheros que borrar a si que OK
			log.warn("El directorio:'" + dir.getAbsolutePath()
					+ "' no existe o no es un directorio");
			return false;
		}
		// el fichero es un directorio
		boolean succed = true;
		File listFile[] = dir.listFiles();
		for (File file:listFile) {
			if (file.isDirectory()) {
				deleteDirRecursively(file);
			} else {
				if (!file.delete()) {
					log.warn("No se ha podido borrar el fichero:'"
							+ file.getAbsolutePath() + "'");
					succed = false;
				}
			}	
		}

		if (!dir.delete()) {
			log.warn("No se ha podido borrar el fichero:'"
					+ dir.getAbsolutePath() + "'");
			succed = false;
		}
		return succed;
	}
395411
public void setWorkDir(String dir) throws IOException
    {
        File workDir = new File(dir);

        if (!workDir.exists() || !workDir.canWrite() || !workDir.canRead())
        {
            throw new IOException("Cannot access directory "+dir);
        }
        _workDir = workDir;
    }
9347
public function getFilesOfDir($dir)
    {
        $iterator = new DirectoryIterator($dir);

        $iterator = new CallbackFilterIterator(
            $iterator,
            function (SplFileInfo $current, $key, DirectoryIterator $iterator) {
                return !$iterator->isDot();
            }
        );

        return $iterator;
    }
589067
public static File[] listFilesSortedByModDate(File dir) {
        File[] backupDirFiles = dir.listFiles();
        Arrays.sort(backupDirFiles, new FileComparator());
        return backupDirFiles;
    }
711503
public function chdir($dir)
    {
        return ($this->isConnected() === true) ? ftp_chdir($this->getConnection(), $dir) : false;
    }
564967
private static Collection<File> findDirsRecursively(File dir) {
		return FileUtils.listFilesAndDirs(dir, FalseFileFilter.FALSE, TrueFileFilter.TRUE);
	}
229254
public static boolean deleteDirectory(File dir)
    {

        if (dir.canWrite()) {
            File [] subFiles = dir.listFiles();

            for(int i=0; i<subFiles.length; i++) {
                if (subFiles[i].isDirectory())
                    deleteDirectory(subFiles[i]);
                else
                    subFiles[i].delete();
            }

        }

        return dir.delete();

    }
882202
private static String createIfNeeded(String dir) {
        File f = new File(dir);
        if (f.exists()) {
            return dir;
        } else {
            boolean success = f.mkdirs();
            if (success)
                return dir;
            else
                return null;
        }
    }
494055
public static int toIsoDirection (int dir)
    {
        if (dir != DirectionCodes.NONE) {
            // rotate the direction clockwise (ie. change SOUTHEAST to
            // SOUTH)
            dir = DirectionUtil.rotateCW(dir, 2);
        }
        return dir;
    }
1125075
final public static function isDirEmpty($dir)
    {
        if (!is_readable($dir)) {
            return (null);
        }
        $handle = opendir($dir);
        while (false !== ($entry = readdir($handle))) {
            if ($entry != "." && $entry != "..") {
                return (false);
            }
        }
        return (true);
    }
32134
public static void deleteSubDirs(File dir) {
        String[] children = dir.list();
        for (int i = 0; i < children.length; i++) {
            File f = new File(dir, children[i]);
            if (f.isDirectory()) {
                deleteDir(f);
            }
        }
    }
76260
public function addHelperDir($dir)
    {
        if (true === file_exists($dir) && true === is_dir($dir)) {
            $this->getApplication()->getAutoloader()->registerNamespace('BackBee\Renderer\Helper', $dir);
        }

        return $this;
    }
1048298
public static boolean clearDirectory(File directory) {
		Assert.isTrue(directory.isDirectory(), "Parameter ist kein Verzeichnis");
		File[] files = directory.listFiles();
		boolean allDeleted = true;
		for (File file : files) {
			if (file.isDirectory()) {
				clearDirectory(file);
			}
			allDeleted &= file.delete();
		}

		return allDeleted;
	}
810754
public static File mkdirs(File dir) throws IOException {
        try {
            return Files.createDirectories(fileToPath(dir)).toFile();
        } catch (UnsupportedOperationException e) {
            throw new IOException(e);
        }
    }
434655
public File[] getAllFilesBelow(File dir) {
        Set allFiles = new HashSet();
        if (dir.isDirectory()) {
            primGetAllFilesBelow(dir, allFiles);
        }
        return (File[]) allFiles.toArray(new File[allFiles.size()]);
    }
1232544
public static Direction createDirection(AtlasEdgeDirection dir) {

        switch(dir) {
        case IN:
            return Direction.IN;
        case OUT:
            return Direction.OUT;
        case BOTH:
            return Direction.BOTH;
        default:
            throw new RuntimeException("Unrecognized direction: " + dir);
        }
    }
1227595
protected function scanDir($dir)
    {
        $fileinfos = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
        $files     = [];
        foreach ($fileinfos as $pathname => $fileinfo) {
            if (!$fileinfo->isFile()) {
                continue;
            }

            $files[] = $pathname;
        }

        return $this->scanArray($files);
    }