文件压缩
@param path
@param delete  是否删除原始文件
@throws Exception
436073
public static void compress(String path, boolean delete) throws Exception {
		File file = new File(path);
		compress(file, delete);
	}
834429
public Response delete(String path, Formattable data) throws AuthyException {
        return request("DELETE", path, data, getDefaultOptions());
    }
840258
@SuppressWarnings("ResultOfMethodCallIgnored")
    static private void deleteDirectory(File path) {
        if (path.exists()) {
            //noinspection ConstantConditions
            for (File f : path.listFiles()) {
                if (f.isDirectory()) {
                    deleteDirectory(f);
                }
                f.delete();
            }
            path.delete();
        }
    }
617590
public static void main(String[] args) throws Exception {
		//TODO error message if root dir does not exist

		zip("C:\\util\\keys\\", "C:\\util\\keys.zip", "*.*");
		System.exit(0);

		if (args.length >= 2) {
			if (args[0].startsWith("-d")) {
				if (args.length == 3) {
					deleteContentsInDirectoryTree(args[1], args[2]);
					return;
				}
				if (args.length == 2) {
					emptyDirectory(args[1]);
					return;
				}
			}
			if (args[0].startsWith("-s")) {
				if (args.length == 2) {
					CollectionSupport.print(getFilesAndDirectoriesInDirectoryTree(args[1], null));
					return;
				}
				if (args.length == 3) {
					CollectionSupport.print(getFilesAndDirectoriesInDirectoryTree(args[1], args[2]));
					return;
				}
				if (args.length > 3) {

					if (args.length == 4 && args[2].startsWith("-f")) {
						List files = getFilesInDirectoryTree(args[1]);
						printOccurringString(files, args[3]);
						return;
					}
					if (args.length == 5 && args[3].startsWith("-f")) {
						List files = getFilesInDirectoryTree(args[1], args[2]);
						printOccurringString(files, args[4]);
						return;
					}
				}
			}
		}
		printUsage();
	}
1308700
@Nonnull
  public static FileIOError deleteFile (@Nonnull final Path aFile)
  {
    ValueEnforcer.notNull (aFile, "Path");

    final Path aRealFile = _getUnifiedPath (aFile);

    if (!aRealFile.toFile ().isFile ())
      return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.DELETE_FILE, aRealFile);

    // Is the parent directory writable?
    final Path aParentDir = aRealFile.getParent ();
    if (aParentDir != null && !Files.isWritable (aParentDir))
      return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.DELETE_FILE, aRealFile);

    return _perform (EFileIOOperation.DELETE_FILE, Files::delete, aRealFile);
  }
574332
public void sweepFile(long now, Path p) throws Exception {
        if (p == null) {
            return;
        }
        long expiry = getExpiryFromFilename(p.getFileName().toString());
        // files with 0 expiry never expire
        if (expiry > 0 && ((now - expiry) >= (5 * TimeUnit.SECONDS.toMillis(gracePeriodSec)))) {
            Files.deleteIfExists(p);
            if (log.isDebugEnabled()) {
                log.debug("Sweep deleted " + p.getFileName());
            }
        }
    }
762113
public void deletePath(final Path path, final boolean recursive) {
    this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        Lock lock = ParallelRunner.this.locks.get(path.toString());
        lock.lock();
        try {
          HadoopUtils.deletePath(ParallelRunner.this.fs, path, recursive);
          return null;
        } finally {
          lock.unlock();
        }
      }
    }), "Delete path " + path));
  }
1179281
public void deleteFile(JimfsPath path, DeleteMode deleteMode) throws IOException {
    store.writeLock().lock();
    try {
      DirectoryEntry entry = lookUp(path, Options.NOFOLLOW_LINKS).requireExists(path);
      delete(entry, deleteMode, path);
    } finally {
      store.writeLock().unlock();
    }
  }
271872
private static String fileAsString(String path) throws Exception {
        StringBuffer buffer = new StringBuffer();
        InputStream fis = new FileInputStream(path);
        InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
        Reader in = new BufferedReader(isr);
        int ch;
        while ((ch = in.read()) > -1) {
            buffer.append((char) ch);
        }
        in.close();
        return buffer.toString();
    }
627093
@Override
  public void deleteWithChildren(String path) throws InterruptedException, KeeperException
  {
    List<String> allChildren = findAllChildren(path);

    for(String child : allChildren)
    {
      delete(PathUtils.addPaths(path, child));
    }

    delete(path);
  }
1020187
public function delete($path)
    {
        $result = @ftp_delete($this->connection, $path);
        
        if ($result === false) {
            throw new Exception('Unable to get parent folder');
        }

        return $this;
    }
1267048
public static function cleanPath($path, $params = ['checkDir' => false, 'checkFile' => false])
    {

        $params = Arr::mergeWithDefaultParams($params);

        if ($params['checkDir']) {
            if (!is_dir($path)) {
                Throw new Exception('Path is not a dir');
            }
        }

        if ($params['checkFile']) {
            if (!is_file($path)) {
                Throw new Exception('Path is not a file');
            }
        }

        return str_replace(array('//'), array('/'), $path);
    }
1011741
public void addFile(String path) throws LoadModelException{
		try {
			ArrayList<String[]> al = loadDict(path);		
			add(al); 
			indexLen = MIN_LEN;
			createIndex();
		} catch (IOException e) {
			throw new LoadModelException("加载词典错误"+e.toString());
		}
	}
378258
public void delete(String path)
        throws DbxException
    {
        DbxPathV1.checkArgNonRoot("path", path);

        String[] params = {
            "root", "auto",
            "path", path,
        };

        doPost(host.getApi(), "1/fileops/delete", params, null, new DbxRequestUtil.ResponseHandler<Void>() {
            @Override
            public Void handle(HttpRequestor.Response response)
                throws DbxException
            {
                if (response.getStatusCode() != 200) throw DbxRequestUtil.unexpectedStatus(response);
                return null;
            }
        });
    }
667999
private void checkDeletable(File file, DeleteMode mode, Path path) throws IOException {
    if (file.isRootDirectory()) {
      throw new FileSystemException(path.toString(), null, "can't delete root directory");
    }

    if (file.isDirectory()) {
      if (mode == DeleteMode.NON_DIRECTORY_ONLY) {
        throw new FileSystemException(path.toString(), null, "can't delete: is a directory");
      }

      checkEmpty(((Directory) file), path);
    } else if (mode == DeleteMode.DIRECTORY_ONLY) {
      throw new FileSystemException(path.toString(), null, "can't delete: is not a directory");
    }

    if (file == workingDirectory && !path.isAbsolute()) {
      // this is weird, but on Unix at least, the file system seems to be happy to delete the
      // working directory if you give the absolute path to it but fail if you use a relative path
      // that resolves to the working directory (e.g. "" or ".")
      throw new FileSystemException(path.toString(), null, "invalid argument");
    }
  }
702435
@Override
  public boolean delete(Path path, boolean recursive) throws IOException {
    LOG.debug("delete({}, {})", path, recursive);
    if (mStatistics != null) {
      mStatistics.incrementWriteOps(1);
    }
    AlluxioURI uri = new AlluxioURI(HadoopUtils.getPathWithoutScheme(path));
    DeletePOptions options = DeletePOptions.newBuilder().setRecursive(recursive).build();
    try {
      mFileSystem.delete(uri, options);
      return true;
    } catch (InvalidPathException | FileDoesNotExistException e) {
      LOG.warn("delete failed: {}", e.getMessage());
      return false;
    } catch (AlluxioException e) {
      throw new IOException(e);
    }
  }
631576
public static boolean deleteRecursive(File path) throws FileNotFoundException {
        if (!path.exists()) {
            throw new FileNotFoundException(path.getAbsolutePath());
        }

        boolean success = true;
        if (path.isDirectory()) {
            for (File f : path.listFiles()) {
                success = success && FileUtils.deleteRecursive(f);
            }
        }

        return success && path.delete();
    }