MakeFileNameSafe
This function will clean up a string to be a safe file path on Mac, Windows or Linux
Average rating: 5.0 (1 vote) Log in to vote
Jon Eisen - Show more from this author
Richard Carlton Consulting.com https://rcconsulting.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
There are a handful of specific characters that are commonly used in strings that are unsafe for filenames across all major platforms. This will substitute them with a passed character.
It does not check that the replacement character is safe, nor do I guarantee that it covers all instances.
It also protects you from accidentally creating a file whose name will cause Windows Explorer to crash every time you try to open the file.
Note: this function removes all spaces which are allowed on Unix-based systems but not windows. Just comment that section out if you want spaces to be allowed.
If you find additional characters, let me know and I can add them.
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.