Question

How to import only selected files from a list in a folder?

  • 19 July 2021
  • 6 replies
  • 20 views

Hi !

I have a folder containing about 20000 jpeg files and separately a list in csv format containing names of some jpeg files which I'll need. How can I import in FME only the jpeg files from the list and not all images in the folder ?

Thank you.

 

 


6 replies

Userlevel 3
Badge +18

Use a FeatureMerger

 

If you do a Directory and File Pathnames Reader on the folder containing jpeg files and then merge the data with the CSV only the items you need will come out of the Merged output port.

 

Use a FeatureMerger

 

If you do a Directory and File Pathnames Reader on the folder containing jpeg files and then merge the data with the CSV only the items you need will come out of the Merged output port.

 

No, I don't want to import more than 20 000 photos to do the feature merge. I need to import in my workbench only from my list.

Thanks.

Badge +22

Read the csv file. Sent the features to a FeatureReader where the Format is jpeg and the Dataset is the attribute containing the full path to the file. You may need to create this attribute beforehand from a combination of published parameters and attributes if the csv only has the file names and not the full path.

Userlevel 3
Badge +18

No, I don't want to import more than 20 000 photos to do the feature merge. I need to import in my workbench only from my list.

Thanks.

The Directory and File Pathnames Reader does not import 20 000 photos. It only reads the file location properties of 20 000 photos.

 

But the solution of jdh is much better. Read the csv and then read the photos based on the filename in the csv. Much quicker indeed.

Do you know if we can do this with a Python script in the file reader ?

 

Thanks.

Userlevel 3
Badge +18

Do you know if we can do this with a Python script in the file reader ?

 

Thanks.

I guess you could. But I don't know you should.

What you want to do is pretty basic FME and Python is almost never needed when using FME. I think the solution is already mentioned by jdh. If not, maybe look at some other answers on the forum or rephrase the question.

Reply