Skip to main content

Hello,

Newbie to FME here, trying to create a simple script to move multiple pdf files all located in one folder to multiple folders which match the name of the folder. Tried using File Copy Writer but had no luck.

Do you mean “Move the PDF to a folder with the same name as the PDF File”?

Simplest approach perhaps:

  1. Use PATH Reader to the Source Folder.  Set Path Filter = *.PDF
  2. Use FilenamePathExtractor to get the File “root name” Eg.  “MyPDF” is the root name of “C:\Temp\MyPDF.pdf”.
  3. Use AttributeCreator to set a format attribute value filecopy_source_dataset to the value of path_unix to tell the Writer to source path of the file(s) (See File Copy Writer Help for what the different format attribute values do within the File Copy Writer)
  4. Write the files using File Copy Writer to set the destination SubFolder to Eg. “_rootname” and setting the File Operation to “Move”

Note: Don’t need FilenamePathExtractor if set the separate PATH Reader Parameter “Retrieve File Properties” to Yes, but sometimes that exposes more information than want on the Workspace and is a little slower to read.

Example workspace

 


You can use transformer “RenameFile” on FMEhub that I created it. Hopefully it help you