From 1527e64ee756e32bfd5a74e70bf15695d79c0a9b Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 19 Jul 2014 12:00:42 +0100 Subject: [PATCH] local: Implement Purger interface --- local/local.go | 10 ++++++++++ 1 file changed, 10 insertions(+) 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{}