Commit bea6b4f4 authored by Yogmatee Roochun's avatar Yogmatee Roochun
Browse files

recursive file download from FTP - removed filtering out directories which are 'dated folders'

parent db9316f2
......@@ -9,12 +9,12 @@ const { checkJobStatus, uncaughtError } = require('../job-runner')
const { FtpAccountManager } = require('../xpub-model')
const path = require('path')
/* if (!process.env.ENABLE_CRONJOB_FROMFTPBULKUPLOAD) {
if (!process.env.ENABLE_CRONJOB_FROMFTPBULKUPLOAD) {
logger.info(
'ENABLE_CRONJOB_FROMFTPBULKUPLOAD not defined. fromFtp-BulkUpload cronjob exits.',
)
process.exit(0)
} */
}
const BULK_UPLOAD_FILE_EXT = new RegExp(/\S+\.tar\.gz$/i)
......@@ -185,14 +185,11 @@ const readDirRecursive = (ftp, startDir) => {
reject(err)
}
// filter out directories which are 'dated folders'
const datedRegex = new RegExp(/\d{4}-\d{2}-\d{2}$/i)
const filteredList = dirList
.filter(ele => !(datedRegex.test(ele.name) && ele.type === 'd'))
.map(ele => ({
objPath: `${dirName}/${ele.name}`,
objType: ele.type,
}))
const filteredList = dirList.map(ele => ({
objPath: `${dirName}/${ele.name}`,
objType: ele.type,
}))
resolve(filteredList)
})
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment