Skip to main content
Archived

PATH Reader: Add ability to retrieve Folder Name

Related products:Transformers

takashi
Influencer
The Directory and File Pathnames (PATH) reader in conjunction with the File Copy writer is very useful to construct or rearrange the directory hierarchy in the disk system.
The features from the PATH reader have several attributes storing file path components (full path, directory path, file name with extension, file name without extension, and extension), but the parent folder name is missing.

C:/abc/xyz/parent/file.ext

Of course it's easy to extract the parent folder name from the full path or directory path using a transformer such as the FilenamePartExtractor, but I feel something redundant.
Sometimes the parent folder name will be used to create a new attribute (e.g. the destination file name), so I think it would be more convenient if the PATH reader could retrieve the parent folder name (e.g. "path_foldername").
<strong>This post is closed to further activity.</strong><br /> It may be a question with a best answer, an implemented idea, or just a post needing no comment.<br /> If you have a follow-up or related question, please <a href="https://community.safe.com/topic/new">post a new question or idea</a>.<br /> If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

Forum|alt.badge.img+5
@takashi, I wonder if the path_rootname for a directory path_type is enough for what you are suggesting? But this would not work when the Subfolders option is checked on the advanced browser.

 

 

For the following folder path configured in Path Reader with Subfolders checked

 

 

H:\\Public\\T&D\\UAS project\\APC 1323A0\\the path_parent is APC 1323A0, and the following path_directoriy_windows will also have the same path_parent APC 1323A0

 

 

H:\\Public\\T&D\\UAS project\\APC 1323A0\\07 24 15\\H:\\Public\\T&D\\UAS project\\APC 1323A0\\07 24 15\\Aircraft\\H:\\Public\\T&D\\UAS project\\APC 1323A0\\07 24 15\\Aircraft\\DCIM\\

 

H:\\Public\\T&D\\UAS project\\APC 1323A0\\07 24 15\\Aircraft\\DCIM\\181AERYN\\H:\\Public\\T&D\\UAS project\\APC 1323A0\\07 24 15\\Aircraft\\DCIM\\182AERYN\\H:\\Public\\T&D\\UAS project\\APC 1323A0\\07 24 15\\Aircraft\\DCIM\\183AERYN

 

I think I can generate a list of path_rootname and then from the list, retrieve the shortest path_rootname as my parent, split the path_rootname on the backward slash and use the last index of the attribute split as my path_parent. I would really prefer that the value be retrieved by the reader.

takashi
Influencer
  • Author
  • November 2, 2016
Hi @geospatiallover, yes, the path_rootname and path_filename will store a folder name for each directory type path. The effect of this idea would be to provide a quick way to retrieve the parent folder name for each file type path.

salvaleonrp
Enthusiast
Forum|alt.badge.img+16
  • Enthusiast
  • November 2, 2016

My solution to retrieve the parent name of a path with Subfolders took a few more transformer than I initially thought. Is there a better way to get that parent name with what I have on that green bookmark? I think the StatisticsCalc may not be necessary but I need to pick the shortest path to extract the parent name. Bringing back that parent name to each feature was an issue to me until I read your post on FME Memo on Join On 11. Thanks!

 

2016-11-02-07-11-16-path-xlsxw-h-2016-uas-projects.png

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