Check for filenames which might be invalid on other platforms

(Bt90) #1

Would it be possible to check the filenames if they are supported on other platforms and emit a warning? It would be nice to have a warning on the machine i created the possibly “unsyncable” file on without having to check it on the other end.


I created a folder with a colon character in its name on Linux. Everything seems to work but my Windows PC seems to be stuck syncing the changes. An (optional) warning about potential untransferable files would solve this IMHO.

Invalid characters for Windows paths: \ / : * ? " < > |

Invalid characters for Mac paths: :

(Audrius Butkevicius) #2

What if both machines are linux, should we warn people too? We don’t know what platform other machine is, and I don’t think we should expose that.

(Bt90) #3

Even if it’s already a paired device?

(Audrius Butkevicius) #4

Don’t see why we should do that. Also, even if we do, you can’t guarantee that the underlying filesystem supports it. For example exFAT or ntfs on linux.

(Antony Male) #5

Don’t forget characters 0 to 31, trailing spaces and periods, and the raft of reserved filenames. These things always end up being more complex than you expect.

(Jakob Borg) #6

Can’t have files named con, prn or aux. :wink:

(Paul) #7

Sorry to resurrect this dead post, but I thought it’d be worth mentioning a ‘workaround’ I use. Not really a true fix for the underlying issue, but ‘resolves’ the pain-point for me.

By substituting unicode characters that have the same visual appearance as a character that would be ‘invalid’ on one or more filesystems, I get the visual representation I want, without the filesystem complaining:

Illegal characters in Windows filenames, according to MSDN:

< (less than) U+003c ˂ (Modifier Letter Left Arrowhead) U+02C2
> (greater than) U+003e ˃ (Modifier Letter Right Arrowhead) U+02C3
: (colon) U+003A (modified letter colon) U+A789
" (double quote) U+0022 (Left Double Quotation Mark) U+201C
(Right Double quotation mark) U+201d
/ (forward slash) U+002f (fraction slash) U+2044
\ (backslash) U+005c
| (vertical bar or pipe) U+007c Fullwidth Vertical Line U+FF5C
? (question mark) U+003f
* (asterisk) U+002a 🞶 (Medium Six Spoked Asterisk) U+1F7B6

While not technically an illegal character, quoting quotes correctly on Linux can be a royal pain, and the result is ugly as well.

' (single quote) U+0027 (Left Single Quotation Mark) U+2018
(Right Single Quotation Mark) U+2019

Some of my scripts take filenames that have an underscore or period used as a separator and converts them to be space-sparated. However, words like ‘S.H.I.E.L.D." and “DD5.1” in the name get mangled, however ‘clever’ I make the heuristic. So I use substitute’one dot leader’ where the ‘period’ should survive such name processing. e.g. Marvel’s Agents of S.H.I.E.L.D.jpg becomes Marvel’s Agents of S․H․I․E․L․D.jpg

. (period) U+002E (One Dot Leader) U+2024

To make life a little easier, I’ve remapped a few keyboard combinations so I can type those characters with one keystroke.