Skip to main content
Solved

"File and directory reader" trick


Forum|alt.badge.img

Hi all,

 

 

According to the docs you have lots of wildcard options available in the"file and directory pathnames reader" ("add reader->Format: Directory and files pathnames). Including greedy searching all subdirectories recursively or fine-grained, hairsplitting controlled directory and file name searching.

 

http://docs.safe.com/fme/reader_writerPDF/path.pdf

 

 

So this kind of structure really should be a breeze: C:\\data2\\dirB\\dirB_1\\Newfeature.txt

 

C:\\data2\\dirB\\dirB_2\\Newfeature.txt

 

C:\\data2\\dirB\\dirB_3\\Newfeature.txt

 

(somewhat simplified).

 

 

 

So I set the source directory to C:\\data2\\dirB and fiddle with the Path filter syntacts.

 

**\\*

 

C:\\data2\\dirB\\**\\*

 

C:\\data2\\dirB\\dirB_?\\*

 

 

None of these work. No, I am not kidding. Go to the PDF I linked, scroll down to the heading Path filter. Then please explain me why.

 

 

What DOES work is moving most of those wildcard into the definition of the Source Directory. These definitions are valid for my example:

 

C:\\data2\\dirB\\**\\

 

C:\\data2\\dirB\\dirB_?\\

 

 

Apparently, the path filter is only usable to provide more fine grained control over the file name only. This separation (directory definition here, file name definition there) is actually logical and intuitive - I like it - but a) the name path filter is highly misleading and b) i beg you:

 

 

Please, please, pretty please update the documentation

 

Best answer by fmelizard

Improvements have been made to the Directory and File Pathnames Reader Parameters documentation. The doc suggests to use forward slashes (/) as separators, as they do not conflict with either glob escape characters or UNC path names. Single backward slashes (\\), for example C:\\data\\*.dgn, may be treated as escape characters, leading to incorrect interpretations. Please take a look at the section Common Path Filter Issues for troubleshooting assistance.

Kind regards,

 

Natalie
View original
Did this help you find an answer to your question?

5 replies

david_r
Evangelist
  • June 21, 2013
Hi,

 

 

I think you should send this directly to Safe support.

 

 

David

Forum|alt.badge.img
To simplify things further: You could simplify this A LOT by getting rid of  the path filer parameter all together. Put the entire search into the path definition, such as

 

 

C:\\data2\\dirB\\dirB_?\\*.txt 

 

 


Forum|alt.badge.img
I am sure the fine folks at Safe are capable of doing that themselves. Or if you'd like to, feel free to post it yourself.

 

 

Right now, I can't be bothered - it is weekend time and dinner preparation,  starting NOW! Cheers! :) 

  • March 11, 2014
Thanks Hektopascal, your insight helped me.

 

 

I'm new and figuring out the differences between the path filter, the path definition (source directory and file pathnames directory), and the merge feature type's merge filter is proving rather confusing.

 

 

But I was able to read my desired files (.TAB files) within the current directory and all sub-directories, by using:

 

 

a path filter of "\\\\networkpath\\subfolder\\**"

 

and a path filter of "*.TAB"

 

and a merge filter of "*.TAB"

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • Best Answer
  • December 9, 2016

Improvements have been made to the Directory and File Pathnames Reader Parameters documentation. The doc suggests to use forward slashes (/) as separators, as they do not conflict with either glob escape characters or UNC path names. Single backward slashes (\\), for example C:\\data\\*.dgn, may be treated as escape characters, leading to incorrect interpretations. Please take a look at the section Common Path Filter Issues for troubleshooting assistance.

Kind regards,

 

Natalie

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings