Skip to main content
Question

File Copy - Iterate - Move to Subfolder not Root File Path

  • June 24, 2019
  • 2 replies
  • 57 views

nz
Forum|alt.badge.img
  • 4 replies

Hi Team,

I have a folder structure with thousands of DWG files in multiple sub folders.

 

Excuse the naming convention, its purely indicative.

Currently as below, all the DWG files reside inside the DWG folder.

 

 

I am trying to create the following,

 

In the current workspace I have a Directory and File and Pathnames reader to FileCopy Writer

The reader reads the "TESTIN" Folder with "Recurse into subfolders" as the checked option, running a path filter of "*.dwg"

I have an Attribute Manager translator to assign 'Path_windows' and "Path_filename" to the writer.

 

Currently the writer output location is set to the same Root level "TESTIN" folder using the "SourceDataset_PATH" parameter (which is default), with the fanout expression of "_PLANS\\DWG"

This result obviously searches all the folders for the .dwg extension and then copies them all to the TESTIN\\_PLANS\\DWG folder that is created by the fan out expression.

My question is, How do I get it to produce the output directories in each subfolder, rather than the root TESTIN folder?

I am relatively new to FME, so the more detail the answer the better!.

Thanks in advance.

nz

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3701 replies
  • June 25, 2019

A SystemCaller with the copy command would do the trick too, although you'd probably have to jiggle some wildcards for a bit, or use a Directory and Files Pathname reader and then iterate through all the .dwg files and issue a separate copy command for each.


nz
Forum|alt.badge.img
  • Author
  • 4 replies
  • June 25, 2019

A SystemCaller with the copy command would do the trick too, although you'd probably have to jiggle some wildcards for a bit, or use a Directory and Files Pathname reader and then iterate through all the .dwg files and issue a separate copy command for each.

Thanks for the reply @redgeographics, I have been scouring multiple threads for answers as well as your suggestion. I have tried a solution to a similar problem set from 2017, Where @takashi suggested using a filesplitter and listindexer. This simple process has allowed for the fan out expression to be enabled to the desired location. In that case the users solution was for a level up using _dirpath, but Takashi's solution was my desired answer for a level below!

https://knowledge.safe.com/questions/42582/how-to-select-a-folder-within-the-folder-path-to-u.html