Purge all files in the directory Implement this if you have a way of deleting all the files quicker than just running Remove() on the result of List() Return an error if it doesn't exist
(ctx context.Context, dir string)
| 240 | // |
| 241 | // Return an error if it doesn't exist |
| 242 | func (f *Fs) Purge(ctx context.Context, dir string) error { |
| 243 | for _, r := range f.upstreams { |
| 244 | if r.Features().Purge == nil { |
| 245 | return fs.ErrorCantPurge |
| 246 | } |
| 247 | } |
| 248 | upstreams, err := f.action(ctx, "") |
| 249 | if err != nil { |
| 250 | return err |
| 251 | } |
| 252 | errs := Errors(make([]error, len(upstreams))) |
| 253 | multithread(len(upstreams), func(i int) { |
| 254 | err := upstreams[i].Features().Purge(ctx, dir) |
| 255 | if errors.Is(err, fs.ErrorDirNotFound) { |
| 256 | err = nil |
| 257 | } |
| 258 | if err != nil { |
| 259 | errs[i] = fmt.Errorf("%s: %w", upstreams[i].Name(), err) |
| 260 | } |
| 261 | }) |
| 262 | return errs.Err() |
| 263 | } |
| 264 | |
| 265 | // Copy src to this remote using server-side copy operations. |
| 266 | // |