I’m trying to read a file but it gives an empty result if the filename contains both type of brackets. It will give a result if I remove the brackets from the filename
most likely the spaces are your problems and not the brackets.
I’m unsure how Windows works (avoiding it since windows 3.1) but with Linux you would put the filename in " " to get around the problems with spaces.
sorry, don’t have a windows where I could spin up n8n to see why it might not work.
I assume you have checked that n8n does have permission to access those folders and can see the files in there?
Escaping the brackets work. How do I auto escape all type of brackets ( ) { } [ } instead of manually inserting cause I’m watching a folder for new files
It seems to only replace one set of brackets and it’s not reoccurring since the filename may contain multiple brackets. After testing I realized the path to file needs to use forward-slash instead of back-slash since n8n requires it even on windows which I don’t know how to do this
Oh yes my mistake it is .replaceAll(). You can replace spaces and backslashes as well.
I believe you need to escape backslashes as well so you do them double.
{{$json.path.replace('[', '\\[').replaceAll(']', '\\]').replaceAll('{', '\\{').replaceAll('}', '\\}')}} etc (add other replacements by appending another .replaceAll(‘’, ‘’))