Skip to main content

Hi!

My task is to rename a few 100 TIFF files.

I have an Excel sheet with the files current names in one column and the corresponding new names in one column, and wounder how I can do this easy in FME (2017).

Thanks

Hi @monzonit,

I guess the most efficient way would be reading the rasters with the Directory and File Pathnames reader, set to retrieve all file parameters.

Add a joiner to the reader feature type and use the xls sheet to join the new names to each raster ( filecopy_dest_filename)

Use the File Copy writer to copy the rasters into a new location using the filecopy_dest_filename.

See more about the File Copy writer here: http://docs.safe.com/fme/2017.0/html/FME_Desktop_Documentation/FME_ReadersWriters/filecopy/filecopy.htm

Hope this helps.


I would use the FileCopy writer, but not read in the rasters at all.

 

 

Read in the excel sheet, use an AttributeCreator/Manager to create attributes named file_copy_source_dataset with the full path to the original file and filecopy_dest_filename with the new filename and send the features to a FileCopy writer.

I would use the FileCopy writer, but not read in the rasters at all.

 

 

Read in the excel sheet, use an AttributeCreator/Manager to create attributes named file_copy_source_dataset with the full path to the original file and filecopy_dest_filename with the new filename and send the features to a FileCopy writer.
This assumes that the path to the original files is either consistant, or part of the excel file.

I would use the FileCopy writer, but not read in the rasters at all.

 

 

Read in the excel sheet, use an AttributeCreator/Manager to create attributes named file_copy_source_dataset with the full path to the original file and filecopy_dest_filename with the new filename and send the features to a FileCopy writer.
How do you add the new name without reading the file properties?

 

 


How do you add the new name without reading the file properties?

 

 

As per the original question, the excel file contains the original filenames in one column, and the new file names in another.

 

So reading in the excel file will give you one feature per raster, with two attributes, original and new.

 

 

Depending on what exactly is in the excel file, the full path may need to be constructed. ie if the excel file contains only "image1", the attributeCreator would be $(Directory)\\@value(original).tif

 

 


As per the original question, the excel file contains the original filenames in one column, and the new file names in another.

 

So reading in the excel file will give you one feature per raster, with two attributes, original and new.

 

 

Depending on what exactly is in the excel file, the full path may need to be constructed. ie if the excel file contains only "image1", the attributeCreator would be $(Directory)\\@value(original).tif

 

 

 

I see must have missed that, agreed reading the xls should be enough if the information is complete, however 'reading' with the directory and filepathnames is very efficient and adds more flexibility to the solution for future use.

Hi again!

Thanks for all the replays, after a few minor bumps this worked excellent!

The Directory and File Pathnames reader gives me the sorting options I need for this task as well!

Will keep experimenting with this function a bit more.

//Pz


Reply