[prev in list] [next in list] [prev in thread] [next in thread]
List: hadoop-commits
Subject: svn commit: r448378 - in /lucene/hadoop/trunk: CHANGES.txt
From: cutting () apache ! org
Date: 2006-09-20 22:33:05
Message-ID: 20060920223306.08FA91A981A () eris ! apache ! org
[Download RAW message or body]
Author: cutting
Date: Wed Sep 20 15:33:05 2006
New Revision: 448378
URL: http://svn.apache.org/viewvc?view=rev&rev=448378
Log:
HADOOP-431. Change 'dfs -rm' to not operate recursively and add a new command, 'dfs \
-rmr', that operates recursively. Contributed by Sameer.
Modified:
lucene/hadoop/trunk/CHANGES.txt
lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=448378&r1=448377&r2=448378
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Sep 20 15:33:05 2006
@@ -51,6 +51,10 @@
modifications are permitted and block replication is inhibited.
(Konstantin Shvachko via cutting)
+14. HADOOP-431. Change 'dfs -rm' to not operate recursively and add a
+ new command, 'dfs -rmr' which operates recursively.
+ (Sameer Paranjpye via cutting)
+
Release 0.6.2 (unreleased)
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java?view=diff&rev=448378&r1=448377&r2=448378
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java Wed Sep 20 \
15:33:05 2006 @@ -255,12 +255,19 @@
/**
* Delete an DFS file
*/
- public void delete(String srcf) throws IOException {
- if (fs.delete(new Path(srcf))) {
- System.out.println("Deleted " + srcf);
- } else {
- System.out.println("Delete failed");
- }
+ public void delete(String srcf, boolean recursive) throws IOException {
+ Path srcp = new Path(srcf);
+ if (fs.isDirectory(srcp) && !recursive) {
+ System.out.println("Cannot remove directory \"" + srcf +
+ "\", use -rmr instead");
+ return;
+ }
+
+ if (fs.delete(srcp)) {
+ System.out.println("Deleted " + srcf);
+ } else {
+ System.out.println("Delete failed");
+ }
}
/**
@@ -367,7 +374,8 @@
" [-du <path>]"+
" [-mv <src> <dst>]"+
" [-cp <src> <dst>]"+
- " [-rm <src>]" +
+ " [-rm <path>]" +
+ " [-rmr <path>]" +
" [-put <localsrc> <dst>]"+
" [-copyFromLocal <localsrc> <dst>]"+
" [-moveFromLocal <localsrc> <dst>]" +
@@ -419,7 +427,9 @@
} else if ("-cp".equals(cmd)) {
copy(argv[i++], argv[i++], conf);
} else if ("-rm".equals(cmd)) {
- delete(argv[i++]);
+ delete(argv[i++], false);
+ } else if ("-rmr".equals(cmd)) {
+ delete(argv[i++], true);
} else if ("-du".equals(cmd)) {
String arg = i < argv.length ? argv[i++] : "";
du(arg);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic