Thumbs.db files fail to upload
adbusey opened this issue · comments
Great project. Would it be possible to skip certain files that are causing the sync to fail? Thumbs.db is forbidden by dropbox. Maybe desktop.ini also, but i haven't run into that.
Thanks!
I'm not actively maintaining this project, so it might be a while before I implement this. You might want to check rclone Dropbox for a more actively maintained alternative
Thanks, that's a good suggestion. It seems to require dropbox business, unlike your project, so hopefully we'll see an update.
If you have some time to make a PR, you can pass a regex expression to the sync cli command in the file cli.py
and check it against the variable "filenames" here
I modified my sync.py after line 74 in /home/user/.local/lib/python3.9/site-packages/dbxcli_extras/.
I've never written in python before. This change does skip the Thumbs.db file, so maybe it's good enough for now.
filename = str(path_i)
#Check for forbidden Thumbs.db sloppily
fbname = filename
fbcount = 9
fblength = len(fbname)
forbiddenname = fbname[fblength - fbcount:]
if forbiddenname=="Thumbs.db": break
r3 = self.sync_file(filename)
Welcome to python! You want:
filename = str(path_i)
if os.path.basename(filename)=="Thumbs.db": continue
With your more effective method, i tried to include most of the banned files documented at https://help.dropbox.com/sync/advanced-sync-troubleshooting
filename = str(path_i)
if os.path.basename(filename)=="Thumbs.db": continue
if os.path.basename(filename)=="thumbs.db": continue
if os.path.basename(filename)=="Desktop.ini": continue
if os.path.basename(filename)=="desktop.ini": continue
if os.path.basename(filename)==".ds_store": continue
if os.path.basename(filename)=="icon\r": continue
if os.path.basename(filename)==".dropbox": continue
if os.path.basename(filename)==".dropbox.attr": continue
if os.path.basename(filename)=="~$*": continue
if os.path.basename(filename)==".~*": continue
I think that solves the issue that i'm personally having with Windows backups, but there are file types that others may have that don't pass the test. "icon\r" probably needs an escape character. The bottom two lines may need .+ or whatever the wildcard is in that context. My issue is resolved though, so thanks!
This one passes all of my tests, very nice!
exclude = ["thumbs.db", "Thumbs.db", "Desktop.ini", "desktop.ini", ".ds_store", "icon\\r", ".dropbox",".dropbox.attr"]
if os.path.basename(filename).strip() in exclude: continue
if os.path.basename(filename).strip().startswith(".~"): continue
if os.path.basename(filename).strip().startswith("~$"): continue