fsantini / KoboCloud

A set of scripts to synchronize a kobo reader with popular cloud services
Other
966 stars 94 forks source link

Not deleting dropbox files with special characters in the name #121

Open louisabraham opened 2 years ago

louisabraham commented 2 years ago

Dropbox files with spaces in their name replace them with %20. When such file is missing on dropbox and the REMOVE_DELETED tries to have it deleted, the process fails. Here is an excerpt of the end of get.log:

Matching remote server
grep: invalid option -- '%'
BusyBox v1.31.1.kobo (2020-04-22 11:41:43 EDT) multi-call binary.

Usage: grep [-HhnlLoqvsriwFE] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]...

Search for PATTERN in FILEs (or stdin)

    -H  Add 'filename:' prefix
    -h  Do not add 'filename:' prefix
    -n  Add 'line_no:' prefix
    -l  Show only names of files that match
    -L  Show only names of files that don't match
    -c  Show only count of matching lines
    -o  Show only the matching part of line
    -q  Quiet. Return 0 if PATTERN is found, 1 otherwise
    -v  Select non-matching lines
    -s  Suppress open and read errors
    -r  Recurse
    -i  Ignore case
    -w  Match whole words only
    -x  Match whole lines only
    -F  PATTERN is a literal (not regexp)
    -E  PATTERN is an extended regexp
    -m N    Match up to N times per file
    -A N    Print N lines of trailing context
    -B N    Print N lines of leading context
    -C N    Same as '-A N -B N'
    -e PTRN Pattern to match
    -f FILE Read pattern from file
-%20Rapport%20Tibi%20-%20FR.pdf not found, deleting
rm: invalid option -- '%'
BusyBox v1.31.1.kobo (2020-04-22 11:41:43 EDT) multi-call binary.

Usage: rm [-irf] FILE...

Remove (unlink) FILEs

    -i  Always prompt before removing
    -f  Never prompt
    -R,-r   Recurse

I think the fix should be proper escaping / quoting.

louisabraham commented 2 years ago

Actually we should: