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: Implement Purger interface

Nick Craig-Wood1527e64ee756
diff --git a/local/local.go b/local/local.go
index 7e4c82280..e4fccbcbd 100644
--- a/local/local.go
+++ b/local/local.go
@@ -253,6 +253,15 @@ func (f *FsLocal) readPrecision() (precision time.Duration) {
return
}
+// Purge deletes all the files and directories
+//
+// 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 *FsLocal) Purge() error {
+ return os.RemoveAll(f.root)
+}
+
// ------------------------------------------------------------
// Return the parent Fs
@@ -426,4 +435,5 @@ func (o *FsObjectLocal) Remove() error {
// Check the interfaces are satisfied
var _ fs.Fs = &FsLocal{}
+var _ fs.Purger = &FsLocal{}
var _ fs.Object = &FsObjectLocal{}