aboutsummaryrefslogtreecommitdiff
path: root/s3_fs.go
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2021-08-23 22:23:19 +0200
committerQuentin <quentin@deuxfleurs.fr>2021-08-23 22:23:19 +0200
commitca6118929197e01afdb58d46cccd25fca6395668 (patch)
tree13029f270e9a9c94885c847d01a537bf0662fab7 /s3_fs.go
parentc63546258287116a7502ee3322f4480c7fcd292b (diff)
downloadbagage-ca6118929197e01afdb58d46cccd25fca6395668.tar.gz
bagage-ca6118929197e01afdb58d46cccd25fca6395668.zip
WIP delete file
Diffstat (limited to 's3_fs.go')
-rw-r--r--s3_fs.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/s3_fs.go b/s3_fs.go
index afc55b7..93ce8ac 100644
--- a/s3_fs.go
+++ b/s3_fs.go
@@ -72,8 +72,25 @@ func (s S3FS) OpenFile(ctx context.Context, name string, flag int, perm os.FileM
}
func (s S3FS) RemoveAll(ctx context.Context, name string) error {
+ //@FIXME nautilus deletes files one by one, at the end, it does not find its folder as it is "already deleted"
s.ctx = ctx
- return errors.New("Not implemented RemoveAll")
+
+ p := NewS3Path(name)
+ if p.class == ROOT {
+ return errors.New("Unable to create another root folder")
+ } else if p.class == BUCKET {
+ log.Println("Deleting bucket is not implemented yet")
+ return nil
+ }
+
+ objCh := s.mc.ListObjects(s.ctx, p.bucket, minio.ListObjectsOptions{Prefix: p.key, Recursive: true})
+ rmCh := s.mc.RemoveObjects(s.ctx, p.bucket, objCh, minio.RemoveObjectsOptions{})
+
+ for rErr := range rmCh {
+ return rErr.Err
+ }
+
+ return nil
}
func (s S3FS) Rename(ctx context.Context, oldName, newName string) error {