1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-23 19:53:24 +00:00

ListFiles Don't delete or create directories in dryRun

This commit is contained in:
niknah
2017-09-15 02:21:07 +10:00
parent 03c2a190ee
commit f74ea0368e

View File

@@ -594,17 +594,16 @@ func (manager *SnapshotManager) ListAllFiles(storage Storage, top string) (allFi
}
}
if !manager.config.dryRun {
if top == "chunks/" {
// We're listing all chunks so this is the perfect place to detect if a directory contains too many
// chunks. Create sub-directories if necessary
if len(files) > 1024 && !storage.IsFastListing() {
for i := 0; i < 256; i++ {
subdir := dir + fmt.Sprintf("%02x\n", i)
if !manager.config.dryRun {
manager.storage.CreateDirectory(0, subdir)
}
}
}
} else {
// Remove chunk sub-directories that are empty
if len(files) == 0 && strings.HasPrefix(dir, "chunks/") && dir != "chunks/" {
@@ -612,6 +611,7 @@ func (manager *SnapshotManager) ListAllFiles(storage Storage, top string) (allFi
}
}
}
}
return allFiles, allSizes
}