aboutsummaryrefslogtreecommitdiffstats
path: root/drive
diff options
context:
space:
mode:
authorPetter Rasmussen2016-02-02 22:38:08 +0100
committerPetter Rasmussen2016-02-02 22:38:08 +0100
commit2a392831aa7112a2faa700a55ad057557a39410b (patch)
tree621705ee4d27c22baca11c44ddc77a8edb7b6b46 /drive
parent3e09b6dad4e90c4a2bcc97b393f3096f7abf2d8d (diff)
downloadgdrive-2a392831aa7112a2faa700a55ad057557a39410b.tar.bz2
Sort files by longest path
Diffstat (limited to 'drive')
-rw-r--r--drive/upload_sync.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/drive/upload_sync.go b/drive/upload_sync.go
index ed1e7a7..748e61d 100644
--- a/drive/upload_sync.go
+++ b/drive/upload_sync.go
@@ -239,6 +239,9 @@ func (self *Drive) deleteExtraneousRemoteFiles(files *syncFiles, args UploadSync
fmt.Fprintf(args.Out, "\n%d extraneous file(s) on drive\n", extraneousCount)
}
+ // Sort files so that the files with the longest path comes first
+ sort.Sort(sort.Reverse(byRemotePathLength(extraneousFiles)))
+
for i, rf := range extraneousFiles {
fmt.Fprintf(args.Out, "[%04d/%04d] Deleting %s\n", i + 1, extraneousCount, filepath.Join(files.root.file.Name, rf.relPath))
err := self.deleteRemoteFile(rf, args)