本文整理了Java中org.apache.hadoop.hive.common.FileUtils.moveToTrash()
方法的一些代码示例,展示了FileUtils.moveToTrash()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.moveToTrash()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.common.FileUtils
类名称:FileUtils
方法名:moveToTrash
[英]Move a particular file or directory to the trash.
[中]将特定文件或目录移动到垃圾箱。
代码示例来源:origin: apache/hive
for (final FileStatus status : statuses) {
if (null == pool) {
result &= FileUtils.moveToTrash(fs, status.getPath(), conf, purge);
} else {
futures.add(pool.submit(new Callable<Boolean>() {
代码示例来源:origin: apache/drill
for (final FileStatus status : statuses) {
if (null == pool) {
result &= FileUtils.moveToTrash(fs, status.getPath(), conf, purge);
} else {
futures.add(pool.submit(new Callable<Boolean>() {
代码示例来源:origin: apache/hive
FileStatus targetStatus = fs.getFileStatus(location);
String targetGroup = targetStatus == null ? null : targetStatus.getGroup();
FileUtils.moveToTrash(fs, location, conf, isAutopurge);
fs.mkdirs(location);
HdfsUtils.setFullFileStatus(conf, status, targetGroup, fs, location, false);
代码示例来源:origin: apache/drill
FileStatus targetStatus = fs.getFileStatus(location);
String targetGroup = targetStatus == null ? null : targetStatus.getGroup();
FileUtils.moveToTrash(fs, location, conf, isAutopurge);
fs.mkdirs(location);
HdfsUtils.setFullFileStatus(conf, status, targetGroup, fs, location, false);
代码示例来源:origin: com.facebook.presto.hive/hive-apache
/**
* Deletes all files under a directory, sending them to the trash. Leaves the directory as is.
* @param fs FileSystem to use
* @param f path of directory
* @param conf hive configuration
* @return true if deletion successful
* @throws FileNotFoundException
* @throws IOException
*/
public static boolean trashFilesUnderDir(FileSystem fs, Path f, Configuration conf) throws FileNotFoundException, IOException {
FileStatus[] statuses = fs.listStatus(f, HIDDEN_FILES_PATH_FILTER);
boolean result = true;
for (FileStatus status : statuses) {
result = result & moveToTrash(fs, status.getPath(), conf);
}
return result;
}
代码示例来源:origin: stackoverflow.com
import java.io.File;
import java.io.IOException;
import com.sun.jna.platform.FileUtils;
public class MoveToTrash {
public static void main(String[] args){
FileUtils fileUtils = FileUtils.getInstance();
if (fileUtils.hasTrash()) {
try {
fileUtils.moveToTrash( new File[] {new File("c:/temp/dummy.txt") });
}
catch (IOException ioe) {
ioe.printStackTrace();
}
}
else {
System.out.println("No Trash available");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!