|
@@ -21,6 +21,7 @@ package org.apache.hadoop.fs.shell;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.LinkedList;
|
|
import java.util.LinkedList;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
import org.apache.hadoop.classification.InterfaceStability;
|
|
import org.apache.hadoop.classification.InterfaceStability;
|
|
@@ -28,6 +29,7 @@ import org.apache.hadoop.fs.PathIOException;
|
|
import org.apache.hadoop.fs.PathIsDirectoryException;
|
|
import org.apache.hadoop.fs.PathIsDirectoryException;
|
|
import org.apache.hadoop.fs.PathIsNotDirectoryException;
|
|
import org.apache.hadoop.fs.PathIsNotDirectoryException;
|
|
import org.apache.hadoop.fs.PathIsNotEmptyDirectoryException;
|
|
import org.apache.hadoop.fs.PathIsNotEmptyDirectoryException;
|
|
|
|
+import org.apache.hadoop.fs.PathNotFoundException;
|
|
import org.apache.hadoop.fs.Trash;
|
|
import org.apache.hadoop.fs.Trash;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -71,6 +73,19 @@ class Delete {
|
|
skipTrash = cf.getOpt("skipTrash");
|
|
skipTrash = cf.getOpt("skipTrash");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ protected List<PathData> expandArgument(String arg) throws IOException {
|
|
|
|
+ try {
|
|
|
|
+ return super.expandArgument(arg);
|
|
|
|
+ } catch (PathNotFoundException e) {
|
|
|
|
+ if (!ignoreFNF) {
|
|
|
|
+ throw e;
|
|
|
|
+ }
|
|
|
|
+ // prevent -f on a non-existent glob from failing
|
|
|
|
+ return new LinkedList<PathData>();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected void processNonexistentPath(PathData item) throws IOException {
|
|
protected void processNonexistentPath(PathData item) throws IOException {
|
|
if (!ignoreFNF) super.processNonexistentPath(item);
|
|
if (!ignoreFNF) super.processNonexistentPath(item);
|