WIP delete file
This commit is contained in:
parent
c635462582
commit
ca61189291
1 changed files with 18 additions and 1 deletions
19
s3_fs.go
19
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 {
|
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
|
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 {
|
func (s S3FS) Rename(ctx context.Context, oldName, newName string) error {
|
||||||
|
|
Loading…
Reference in a new issue