Question

Extract and copy sub folder

  • 17 January 2022
  • 2 replies
  • 8 views

Hi. I have a folder name PLAN. In the folder PLAN i have a lot of subfolders (B53, B54, B89, etc..). More then 500. In each subfolder (b55 for example) i have a subfolder name TERRITOIRE (PLAN/B54/TERRITOIRE, PLAN/B109/TERRITOIRE), and also other folders with other name. I want copy TERRITOIRE subfolder from each subfolder in a new folder with the name of subfolder.

NEWFOLDER/B56/ TERRITOIRE

NEWFOLDER/B55/TERRITOIRE.

 

Thank for help.

 

 

 

 


2 replies

Userlevel 4
Badge +30

Hi @hugues​ 

 

Did you try the Writer FileCopy?

 

Thanks in Advance,

Danilo

Userlevel 2
Badge +17

Hi @hugues​ , you can use the Directory and File Pathnames [PATH] reader with these parameter settings to extract all the paths of TERRITOIRE folders under the root folder PLAN.

  • Source Dataset: <PLAN folder path>
  • Path Filter: TERRITOIRE
  • Recurse Into Subfolders: Yes
  • Allowed Path Type: Directory

 

Rename "path_unix" (full path of 'TERRITOIRE') to "filecopy_source_dataset", then extract subfolder name (e.g. 'B54', 'B109') from the full path with the FilenamePartExtractor (use Folder Name Attribute).

 

Finally copy the TERRITOIRE folder(s) with the File Copy writer.

  • Destination Dataset <NEWFOLDER folder path>
  • Subfolder Name: <attribute storing subfolder name extracted with FilenamePartExtractor>
  • Copy Source Folder: Yes

Reply