The dropbox cli already lets you ignore folders. I've have had the following script for many years to ignore node_modules:
exclude_folders=$(find . -type d -name "node_modules" | grep -v "node_modules/")
echo "Excluding $exclude_folders"
dropbox exclude add $exclude_folders
dropbox exclude list
The feature I want is pattern-based ignore in a .dropboxignore file.