Skip to main content

Hello Forum,

 

What is the best method for moving an entire folder (which includes subfolders, each containing files) from location A to location B?

 

I’ve looked into File Copy, but that doesn’t seem to do the job. Well, I couldn’t see how it can told to do so. In addition there didn't appear to be a writing option (to set the destination location) within it.

 

I’ve also look into the ‘Select Multiple Folders/Files option in FeatureReader. I can see that I can select an entire folder but it’s asking for a Format. Typically when using a FeatureReader, say for reading in a shapefile, I’d choose ESRI Shapefile. But this is different. Here I’m picking an entire folder with contents. So, what ‘format’ would I choose, if indeed this is the right approach?

 

I’m  keen to get this sorted as I need to place a schedule on to it through FME Flow.

 

Thanks,

Stuart

Hi @scarter, you want to move a folder each time you run your workbench?
You could try the SystemCaller which allows a user to give commands that make it possible for example to delete, copy or move folders in the folders you want.

For the exact command as input for the System Caller you could use this website for some guidance:
Move Folders and Subfolders Using CMD: Three Commands (minitool.com)


Thanks for that, @lambertus .

 

So, do you mean create the command in RoboCopy (I’ve used that before - pretty decent, I thought) or in Command Prompt. And then use SytstemCaller in FME for run that RoboCopy or Command Prompt item?

 

As opposed to getting FME Form to do the whole lot.


Hi @scarter,

I was able to move files and subfolders to another location using the following workspace

I use a Directory and File Pathnames reader to get the paths of the folder I want to move or copy to another location and a File copy writer to move said folder.

 

Hoping this helps


Thanks for that @doko  . I’ll give that a go.

 

 


File Copy Feature Writer is the FME way. But I think it is not very intuitive, sample workspace attached.

Alternative is SystemCaller with cmd commands.


Hi @nielsgerrits,  

This method is definitely getting me close to a solution.

This is what I have in location A (it’s just mock-up data and folders purely for this test)…

 

This is what I’ve set up in FME Form…

 

This is what I get at location B (the destination)…

 

You can see that the two sub folders (Zones, and Sites) that are inside the folder I pointed to (location A) have come over to location B. But they’ve done so as isolated folders. I would have hoped they’d come over as sub-folders within a folder called TestFolderMove.

How can I make that happen?

Thanks


HI @nielsgerrits 

 

Another issue is that is removes the folder and files from location A. I don’t want it to do that. I need the folder and files to be left in location A.

 

Thanks,

 


This is all fixed now. Everything is working as wanted. Thanks.


Reply