Solved

Append filename field to .csv bulk import Reader

  • 6 February 2023
  • 2 replies
  • 6 views

Badge

I have 15 .csv files with different names but the same fields and a total of 1406 records. They are in the same directory. I want to merge all 15 files together and append the source file name to each record. I've tried FilenamePartExtractor, FilePathExtractor, and FeatureReader but haven't been able to to get the desired result. I usually get back more records than I put in. Is there a straight forward method to append file name to each record?

icon

Best answer by david_r 6 February 2023, 16:20

View original

2 replies

Userlevel 4

I'm not sure what the FilePathExtractor does, but based on the description on FME Hub I'm doubting it's what you want.

The easiest is probably to expose the feature attribute "fme_basename" on the reader and then rename it as required before writing. This attribute will contain the source CSV filename minus the file extension.

image

Badge

Wow! That was simple. I wasn't familiar with the term "basename". I was looking for filename or windows parameters

Reply