Skip to main content
Question

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


nz
Forum|alt.badge.img

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

2 replies

redgeographics
Celebrity
Forum|alt.badge.img+48

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
  • June 25, 2019
redgeographics wrote:

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

 

 


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