How to sync S3 with millions of files at root

Here is the corrected script