Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

local: delete backend implementation of Purge to speed up and make stats

Nick Craig-Wood6ff1b6c50572
diff --git a/backend/local/local.go b/backend/local/local.go
index 6f7f1f982..a260a2255 100644
--- a/backend/local/local.go
+++ b/backend/local/local.go
@@ -793,27 +793,6 @@ func (f *Fs) readPrecision() (precision time.Duration) {
return
}
-// Purge deletes all the files in the directory
-//
-// Optional interface: Only implement this if you have a way of
-// deleting all the files quicker than just running Remove() on the
-// result of List()
-func (f *Fs) Purge(ctx context.Context, dir string) error {
- dir = f.localPath(dir)
- fi, err := f.lstat(dir)
- if err != nil {
- // already purged
- if os.IsNotExist(err) {
- return fs.ErrorDirNotFound
- }
- return err
- }
- if !fi.Mode().IsDir() {
- return fmt.Errorf("can't purge non directory: %q", dir)
- }
- return os.RemoveAll(dir)
-}
-
// Move src to this remote using server-side move operations.
//
// This is stored with the remote path given.
@@ -1571,7 +1550,6 @@ func (d *Directory) Hash() {
// Check the interfaces are satisfied
var (
_ fs.Fs = &Fs{}
- _ fs.Purger = &Fs{}
_ fs.PutStreamer = &Fs{}
_ fs.Mover = &Fs{}
_ fs.DirMover = &Fs{}
diff --git a/docs/content/overview.md b/docs/content/overview.md
index dc37a8d4d..0fb297825 100644
--- a/docs/content/overview.md
+++ b/docs/content/overview.md
@@ -527,7 +527,7 @@ upon backend-specific capabilities.
| WebDAV | Yes | Yes | Yes | Yes | No | No | Yes ³ | No | No | Yes | Yes |
| Yandex Disk | Yes | Yes | Yes | Yes | Yes | No | Yes | No | Yes | Yes | Yes |
| Zoho WorkDrive | Yes | Yes | Yes | Yes | No | No | No | No | No | Yes | Yes |
-| The local filesystem | Yes | No | Yes | Yes | No | No | Yes | Yes | No | Yes | Yes |
+| The local filesystem | No | No | Yes | Yes | No | No | Yes | Yes | No | Yes | Yes |
¹ Note Swift implements this in order to delete directory markers but
it doesn't actually have a quicker way of deleting files other than