diff options
| author | Petter Rasmussen | 2016-02-02 22:38:08 +0100 |
|---|---|---|
| committer | Petter Rasmussen | 2016-02-02 22:38:08 +0100 |
| commit | 2a392831aa7112a2faa700a55ad057557a39410b (patch) | |
| tree | 621705ee4d27c22baca11c44ddc77a8edb7b6b46 /drive | |
| parent | 3e09b6dad4e90c4a2bcc97b393f3096f7abf2d8d (diff) | |
| download | gdrive-2a392831aa7112a2faa700a55ad057557a39410b.tar.bz2 | |
Sort files by longest path
Diffstat (limited to 'drive')
| -rw-r--r-- | drive/upload_sync.go | 3 |
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) |
