mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-06 12:07:51 +01:00
optionally delete empty parent directories
This commit is contained in:
1 parent
9612457a32
commit
a8a4bc06e8
8 files changed
+297
-268
No files matched your search
@@ -295,7 +295,20 @@ func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntr
|
||||
resp = &filer_pb.DeleteEntryResponse{}
|
||||
if err != nil && err != filer_pb.ErrNotFound {
|
||||
resp.Error = err.Error()
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Optional cleanup of empty parent directories
|
||||
if req.DeleteEmptyParentDirectories {
|
||||
stopAtPath := util.FullPath(req.DeleteEmptyParentDirectoriesStopPath)
|
||||
if stopAtPath == "" {
|
||||
stopAtPath = util.FullPath(fs.filer.DirBucketsPath)
|
||||
}
|
||||
|
||||
// Clean up empty parent directories starting from req.Directory
|
||||
fs.filer.DeleteEmptyParentDirectories(ctx, util.FullPath(req.Directory), stopAtPath)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user