async function copyDir(baseDirectory, directory, filter, directoryReplacement) {
        let files = await new Promise(res => SA.projects.foundations.utilities.filesAndDirectories.getAllFilesInDirectoryAndSubdirectories(baseDirectory + directory, (f) => res(f)))
        if(filter !== undefined) {
            files = files.filter(filter)
        }
        files.forEach(file => {
            let fileParts = file.replaceAll('\\','/').split('/')
            const fileName = fileParts.length === 1 ? fileParts[0] : fileParts.splice(fileParts.length-1)[0]
            const originalDir = fileParts.length > 0 ? fileParts.join('/') + '/' : ''
            let remoteDir = originalDir
            if(directoryReplacement !== undefined && directoryReplacement.length == 2) {
                remoteDir = originalDir.replace(directoryReplacement[0], directoryReplacement[1])
            }
            copyFile(baseDirectory + originalDir, global.env.PATH_TO_PAGES_DIR + '/' + remoteDir, fileName) 
        })
    }
@param {string} baseDirectory 
@param {string} directory 
@param {(string)=>boolean} filter
@param {string[]} directoryReplacement