1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-15 15:53:41 +00:00

Implement Purger interface and drive.Purge

This commit is contained in:
Nick Craig-Wood
2013-01-18 17:01:47 +00:00
parent a0a789ff0f
commit 6e732f3dc0
4 changed files with 55 additions and 10 deletions

View File

@@ -354,9 +354,17 @@ func rmdir(fdst, fsrc Fs) {
//
// FIXME doesn't delete local directories
func purge(fdst, fsrc Fs) {
DeleteFiles(fdst.List())
log.Printf("Deleting path")
rmdir(fdst, fsrc)
if f, ok := fdst.(Purger); ok {
err := f.Purge()
if err != nil {
stats.Error()
log.Fatalf("Purge failed: %s", err)
}
} else {
DeleteFiles(fdst.List())
log.Printf("Deleting path")
rmdir(fdst, fsrc)
}
}
type Command struct {