Skip to main content

Hello everyone,

I am attempting to copy a select number of files from a given directory and came across the FileCopy writer. After experimenting with it, it appears that it is copying all the files specified in the source directory whereas I would like to specify which ones it copies instead. Can anyone confirm this limitation in the writer? And of course, I would be very happy to hear any ideas and workarounds for this. I am considering using PythonCaller to accomplish this but I would like to avoid this if at all possible.

It's not a limitation of the writer so it sounds like you've not got it setup quite right. If you have the filecopy_source_dataset set to a folder rather than a file it will copy the whole folder


In addition to what @ebygomm said, you can also use the "Directory and File Pathnames" reader to get all the filenames in a specific location and then e.g. use the Tester or whatever to select only the files you want to process with the FileCopy writer.


In addition to what @ebygomm said, you can also use the "Directory and File Pathnames" reader to get all the filenames in a specific location and then e.g. use the Tester or whatever to select only the files you want to process with the FileCopy writer.

This is a relief to hear though I can't seem to determine the error(s). I have attached a screenshot of the model. Note, the source directory has over 400 .tif files. I only want the ones I've passed through the testfilter to be written to the destination, but instead all of the .tif files in the source directory (400+) are getting written.


This is a relief to hear though I can't seem to determine the error(s). I have attached a screenshot of the model. Note, the source directory has over 400 .tif files. I only want the ones I've passed through the testfilter to be written to the destination, but instead all of the .tif files in the source directory (400+) are getting written.

It looks like the value you are using for filecopy_source_dataset is the entire folder, it needs to include the filename as well

An example

If you want to copy a file called image.tif that's in location C:\\TEMP\\2020 to a new folder called current in C:\\TEMP you need the attributes setting as follows

filecopy_source_dataset: C:\\TEMP\\2020\\image.tif

filecopy_dest_dataset: C:\\TEMP\\current

filecopy_dest_filename: image.tif


It looks like the value you are using for filecopy_source_dataset is the entire folder, it needs to include the filename as well

An example

If you want to copy a file called image.tif that's in location C:\\TEMP\\2020 to a new folder called current in C:\\TEMP you need the attributes setting as follows

filecopy_source_dataset: C:\\TEMP\\2020\\image.tif

filecopy_dest_dataset: C:\\TEMP\\current

filecopy_dest_filename: image.tif

@ebygomm Thank you very much for sharing this. It's working now! The misunderstanding was that I was under the impression that the filecopy_source_dataset only refered to the directory path but as you illustrated it requires the file path.


Reply