From 09383860e94e3d6f44a1c894a2782a953e07b451 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 4 Dec 2018 22:57:23 -0800 Subject: [PATCH] HCFS recursively delete files --- .../src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java index eddf9e89e..c4b5683ce 100644 --- a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java +++ b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java @@ -116,6 +116,13 @@ public class SeaweedFileSystemStore { return true; } + if (recursive && isDirectroy) { + List entries = lookupEntries(path); + for (FilerProto.Entry entry : entries) { + deleteEntries(new Path(path, entry.getName()), entry.getIsDirectory(), recursive); + } + } + FilerProto.DeleteEntryResponse response = filerGrpcClient.getBlockingStub().deleteEntry(FilerProto.DeleteEntryRequest.newBuilder() .setDirectory(getParentDirectory(path))