Skip to main content

Dear community,

When I try to scan a directory where the folder contains brackets the files in this folder are not being read.

I can imagine why brackets cause problems but sadly this data is often external input. Does a workaround exist? (Other than scanning folders for brackets and edit the folders.)

folder:

output:

 

path_windows

 

D:\\tmp\\New folder (25)\\input\\test

 

D:\\tmp\\New folder (25)\\input\\ttest]

 

D:\\tmp\\New folder (25)\\input\\test\\data.txt

 

D:\\tmp\\New folder (25)\\input\\test\\edata].txt

missing output:

 

D:\\tmp\\New folder (25)\\input\\ntest]\\data.txt

 

D:\\tmp\\New folder (25)\\input\\itest]\\tdata].txt

Hoi @nielsgerrits I dont think a workaround is possible with the Files and Directory Reader, so some kind of manipulation beforehand of the folder and file names will be probably needed.

Probably a python script can be used for that, but also good old DOS (dir and rename) can be used with the SystemCaller.

Hope this helps

removebracketsfromfoldername.fmw


Hoi @nielsgerrits I dont think a workaround is possible with the Files and Directory Reader, so some kind of manipulation beforehand of the folder and file names will be probably needed.

Probably a python script can be used for that, but also good old DOS (dir and rename) can be used with the SystemCaller.

Hope this helps

removebracketsfromfoldername.fmw

Nice one, SystemCaller is getting a favorite transformer.
I can't think of a workaround, but I have filed this issue with our developers as PR#73743

 

If it's a small fix then maybe we'll be able to get it into FME2017 (no guarantees though)

 


Thanks @Mark2AtSafe, one of the reasons for me to post these isolated reproducers is to give you guys input for making even better software. 🙂 Wondered if a list of characters causing this problem is available so I could test input folders? I could generate something myself with ascii codes but if available allready...

 

 


OK, I see an update to our documentation to cover this scenario. It says...


C:[data]Sometimes specifying the glob pattern syntax can conflict with the special characters in the path. In this case, the directory contains [] characters and by default will be misinterpreted as a glob pattern.

This case can be read correctly by removing the default glob pattern ‘*’ and leaving the Path Filter empty. This will disable glob interpretation and the path will be interpreted literally.


I hope that helps. These brackets are a special case because of how they are usually used for a pattern, so I'm hopeful no other special characters should cause similar problems.


Reply