backuparcgis-service

sort files by date

2/1/2019 9:12:27 PM

Changes

index.js 1(+1 -0)

Details

index.js 1(+1 -0)

diff --git a/index.js b/index.js
index 149d030..cacf364 100644
--- a/index.js
+++ b/index.js
@@ -68,6 +68,7 @@ class BackupArcGISService {
 
         // get latest file in directory
         const files = await fsPromises.readdir(`${this.workingDir}/archive/${itemId}`)
+        files.sort()
         const latest = files[files.length - 1]
         const latestHash = await hashFile(`${this.workingDir}/archive/${itemId}/${latest}`, handleErr)
         if(tmpHash === latestHash) {