Skip to main content
Solved

File Copy - Copy empty Folders

  • July 11, 2019
  • 10 replies
  • 113 views

oscard
Influencer
Forum|alt.badge.img+22

Good evening.

I need to copy all the content from a folder to another one. That means files and subfolders.

I have been able to copy any file or subfolder with files, but if the subfolder is empty, it is not copied.

 

I've been playing around with the filecopy_dest_dataset attribute, but no luck.

 

I bet is something obvious, but I'm stuck.

 

 

I'm using FME 2019.0.2 (64-bits)

Thanks for any help provided!

Best answer by hollyatsafe

Hi @oscard,

In the Navigator under the Writer parameters please try changing 'Copy Subfolders' to Yes.

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.

10 replies

Forum|alt.badge.img+2
  • Best Answer
  • July 11, 2019

Hi @oscard,

In the Navigator under the Writer parameters please try changing 'Copy Subfolders' to Yes.


oscard
Influencer
Forum|alt.badge.img+22
  • Author
  • Influencer
  • July 12, 2019

Hi @oscard,

In the Navigator under the Writer parameters please try changing 'Copy Subfolders' to Yes.

I already tried that, but the empty folders are being ignored.


oscard
Influencer
Forum|alt.badge.img+22
  • Author
  • Influencer
  • July 12, 2019

As a workaround, I have ignored the File Copy and use a SystemCaller with the XCopy /E command.

 

 

I still would like to know if the same behaviour is possible with the File Copy.

Forum|alt.badge.img+2

I already tried that, but the empty folders are being ignored.

Hi @oscard,

I think the issue might be in how you are defining you file path, for example if I want to copy empty folder 'abc'

If

filecopy_source_dataset=\\Users\\hcoxon\\Desktop\\2018\\abc

 

folder abc will not be copied but if

filecopy_source_dataset=\\Users\\hcoxon\\Desktop\\2018

 

folder abc will be copied over.

 

This is because the FileCopy Writer looks at moving files or the contents of a folder - this means in order for 'abc' to copied it needs to be treated as a subfolder within the source dataset filepath. In your Directory and File Pathnames Reader I think if you expose the path_ directory_windows attribute to use as the filecopy_source_dataset this might work.


takashi
Celebrity
  • July 14, 2019

I think all subfolders including empty ones could be copied if you set the source root folder path to the "filecopy_source_dataset" and set Yes to the Copy Subfolders parameters in the File Copy Writer. See also the attached demo.

filecopy-writer-example.zip (FME 2019.0.2)


pratap
Contributor
Forum|alt.badge.img+12
  • Contributor
  • July 15, 2019

@oscard, Is it solved?


oscard
Influencer
Forum|alt.badge.img+22
  • Author
  • Influencer
  • July 15, 2019

I think all subfolders including empty ones could be copied if you set the source root folder path to the "filecopy_source_dataset" and set Yes to the Copy Subfolders parameters in the File Copy Writer. See also the attached demo.

filecopy-writer-example.zip (FME 2019.0.2)

I could swear I had already tried this the other day... I guess my brain is functioning better now after the weekend rest.

 

 

Thanks! That works.

gisbradokla
Enthusiast
Forum|alt.badge.img+17
  • Enthusiast
  • December 29, 2020

I think all subfolders including empty ones could be copied if you set the source root folder path to the "filecopy_source_dataset" and set Yes to the Copy Subfolders parameters in the File Copy Writer. See also the attached demo.

filecopy-writer-example.zip (FME 2019.0.2)

@Takashi Iijima​ @hollyatsafe​  I am not sure what I am doing wrong. I want to move folders after my workbench completes successfully. but I cant get this to do anything. I have my filepathreader set to the root of where i want to move the folder from. and both the source and dest set in the filecopy transfomer.


Forum|alt.badge.img+2

@Takashi Iijima​ @hollyatsafe​  I am not sure what I am doing wrong. I want to move folders after my workbench completes successfully. but I cant get this to do anything. I have my filepathreader set to the root of where i want to move the folder from. and both the source and dest set in the filecopy transfomer.

Hi @Brad Nesom​ ,

 

It looks like you have 'Redirect to FME Data Inspector' enabled in your workspace. This should be indicated when you run the workspace at the end of the log file. There is a warning section that states:

 

*** All writer output has been redirected to the Data Inspector ***

 

When this parameter is enabled features will be rerouted to the inspector/visual preview instead of being written out. Disable this setting by selecting Writers in the menu and unchecking 'Redirect to FME Data Inspector'. Alternatively, this setting can be found in the Navigator > Workspace Parameters > Reader/Writer Redirect. Once updated the FileCopy writer should now perform the copy.

 

Second, in your workspace, since you are manually setting the filecopy_source_dataset parameter under the User attributes in the filecopy writer feature type the FeatureReader is not actually doing anything and should be removed.


gisbradokla
Enthusiast
Forum|alt.badge.img+17
  • Enthusiast
  • December 30, 2020

@Takashi Iijima​ @hollyatsafe​  I am not sure what I am doing wrong. I want to move folders after my workbench completes successfully. but I cant get this to do anything. I have my filepathreader set to the root of where i want to move the folder from. and both the source and dest set in the filecopy transfomer.

@hollyatsafe​ you were correct on both counts. however now i get 12 items skipped.

2020-12-30 14:00:29| 1.4| 0.0|WARN |File Copy Writer: Skipped 12 features that were missing source datasets

Just fixed it!

Thanks for the help