Thanks a lot! This script works great. One issue I have with it: if there is a Unicode character in a file name, there is something going wrong and the file gets re-uploaded - as if the script had problems comparing Unicode file names.

I have already changed the encoding to 'utf-8' when opening files, but I am not sure how to fix it for the actual file names. Python 3 supports Unicode out-of-the-box, so it might be a problem specific to Pythonista...