Solved

FILECOPY: a "Hello World" example please

  • 14 April 2021
  • 4 replies
  • 190 views

Badge +8

Could someone please provide a dead simple "Hello World!" example of using the FILECOPY writer? Try as I might I can't figure out how to get this to work. Thanks.

 

This is what I've done so far:

  1. FME Workbench >> File new >> Blank workspace
  2. Writers >> Add >> FILECOPY
    1. Dataset: \\\\server\\share\\source folder >> OK
  3. Open "user attributes" and set:
    1. filecopy_source_dataset = "\\\\server\\share\\source folder\\filename.ext"
    2. filecopy_dest_dataset = d:\\temp
    3. filecopy_dest_filename = xx-my-filename.ext

 

At this point "Run Workspace" doesn't work. "Run to this" does work, but aside from filling the log window nothing appears to happen.

Workspace and log are attached.

 

 

icon

Best answer by mattwilkie 13 June 2022, 20:56

View original

4 replies

Userlevel 4
Badge +30

Hi @mattw1ilkie​ 

 

Please, insert the trasformer Creator and execute your Workspace.

 

Creator_Workspace 

Thanks,

Danilo

Badge +8

Ok, thank you. That was enough to get me to something workable.

For anyone else finding themselves in the same place I was there's a few quirks to be aware of:

  • When you add the filecopy writer the Dataset parameter it prompts for is the Destination folder, not input.
  • The actual parameters (source, target, filename) are set via User Attributes.
  • The help doc page says paths must use foreslash or double-backslash, but that's not the case for me (FME Desktop v2020.2) However:
    • Don't use quotes even if the path has a spaces.
  • If defined, the User Attribute "filecopy_dest_dataset" parameter overrides whatever is selected for Destination Dataset in the prompt when the workspace is run.

Here's my working example:

filecopy-working-example

Badge +8

A cleaner method is to use PATH reader (called "Directory and File Pathnames" in the Add Reader dialog), feed to Attribute Manager, and use Att-Man's outputs in File Copy:

PATH reader --> Atttribute Manager --> FILECOPY Writer flow diagram2022-07-27 10_31_16-_PATH → FILECOPY (Untitled) - FME Workbench 2022.02022-07-27 10_38_57-_PATH → FILECOPY (Untitled) - FME Workbench 2022.0There doesn't seem to be a way to stop FileCopy from creating a subfolder in the destination. 

 

Discovered by way of: https://community.safe.com/s/question/0D54Q00008q3xsMSAQ/i-have-a-fairly-simple-problem-but-cant-seem-to-figure-it-out-i-need-to-copy-one-excel-file-to-another-folder-and-rename-the-copied-file-ive-tried-using-the-path-reader-and-the-file-copy-writer-but-nothing-seems-to-get-copied-any-ideas?t=1655144604807

 

Ok, thank you. That was enough to get me to something workable.

For anyone else finding themselves in the same place I was there's a few quirks to be aware of:

  • When you add the filecopy writer the Dataset parameter it prompts for is the Destination folder, not input.
  • The actual parameters (source, target, filename) are set via User Attributes.
  • The help doc page says paths must use foreslash or double-backslash, but that's not the case for me (FME Desktop v2020.2) However:
    • Don't use quotes even if the path has a spaces.
  • If defined, the User Attribute "filecopy_dest_dataset" parameter overrides whatever is selected for Destination Dataset in the prompt when the workspace is run.

Here's my working example:

filecopy-working-example

Thank you, this is what I needed to get it working! thanks for taking the time to write back your findings!

Reply