KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Working with system files and folders
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: October 12, 2020

When working with files and folders there are two path syntaxes that can be used, the stystem's syntax or POSIX. The system's syntax depends on the operating system. On Windows, folders and files are separated by backslashes(\) and on Mac, they are separated by colons (:). POSIX is a standard defined by the IEEE in which files and folders are separated by a forward slash.

To reduce confusion and errors it is best to stay consistent and stick with one type of syntax, the system or POSIX, if a specific format is retrieved it can be converted using the commands
Convert path system to POSIX
Convert path POSIX to system


It can be harder to maintain control when the path is a user input. In these cases it might be beneficial to use the commands
Select document
Select folder

Which will make sure the results are returned in system format and then can be manipulated as needed.

If the input is a string from the user, the syntax attempted to be confirmed by checking the separator. The 4D constannt folder seporator will contain the system syntax folder separator. If a new folder or file is not being created the path can also be confirmed using Test path name.

These are some ways to properly work with folders and files while reducing potential issues due to path syntax.