MacOS – Find Windows incompatible file / folder names


Is it possible to detect files / folders that are incompatible with Windows in Mac?

We are uploading all our files to Dropbox (from Mac) and we have found that folders with names like "< 2014" are not uploading.

I have found an app called Filerr but it's not downloadable anymore.

Best Answer

The rules of what is a valid windows filename is extremely complex, see here. It depends on the file system and for instance also on where the Dropbox folder is mounted in Windows (since the complete path name in windows is not allowed to exceed a certain number of characters). And since OSX doesn't know where you will mount Dropbox under windows, it can't guarantee that a particular file will work.

Now, there is an easier question on whether we can find all files containing a character that is illegal in windows filenames, namely <>:"/\|?* (according to the same document). This is quite easy using the commandline:

find . -name '*[<>:"/\\|?*]*'

Run this in the Dropbox directory (or replace the . with the Dropbox directory), and it should give you a list. The rationale is that in a filename [] is being used to mean: one of these characters. So I'm asking to list any file under this directory that contains one of these characters. Within the brackets, I only need to escape the backslash.

(now note that this command will also theoretically catch many filenames that are not valid on OSX, so can never be there in the first place, but that doesn't matter).