From 6ff1b6c50572d68778e8954a236e3ab343bff860 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 7 Feb 2024 21:50:22 +0000 Subject: [PATCH] local: delete backend implementation of Purge to speed up and make stats In this commit (2014 for v1.02) Purge was implemented for the local backend: 1527e64ee756e32b local: Implement Purger interface This appeared to be implemented just to make a Purge and doesn't appear to do anything useful. It is in fact significatly worse than the rclone fallback purge since it doesn't operate in parallel or update stats. This patch removes the Purge routine for a consequent speed up and showing of stats. See: https://forum.rclone.org/t/progress-flag-for-rclone-purge/44416 --- backend/local/local.go | 22 ---------------------- docs/content/overview.md | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) 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