Solved

How to change filename extension via FME?

  • 13 December 2017
  • 9 replies
  • 36 views

Badge +1

Hello,

please, I have one problem to solve. Is it possible to change filename extension in FME? E.g. I need to change filename "Analysis.doc" to "Analysis.docx" automatically in workspace. Probably some Python script is suitable there... Unfortunately, I´m not Python expert.

Could anybody help me please?

Thak You so much!

Lubo

icon

Best answer by ebygomm 13 December 2017, 15:23

View original

9 replies

Userlevel 1
Badge +21

You can do this using the filecopy writer in fme

Userlevel 2
Badge +16

Or you can use the SystemCaller to use the DOS copy command.

Userlevel 1
Badge +21

You can do this using the filecopy writer in fme

 

An example of reading all the .doc files in a directory, using the filecopy writer to create .docx followed by a system caller to delete the original

 

 

Userlevel 5
Badge +25

Or you can use the SystemCaller to use the DOS copy command.

I'd recommend the REN command (rename) rather than copy.

 

 

Badge +1

Hello @erik_jan, @egomm and @redgeographics,

Im not sure, if REN command in SYSTEMCALLER can help me... Probably, I should be more specific - I need to convert file with extension ".svg.gz" to special extension ".svg+px". Is it possible via REN command please?

Userlevel 4

If you need to manipulate a filename in an attribute (as opposed to the name of an actual file), there's also the FilenamePartExtractor which lets you split a path and/or filename into its individual parts.

Badge +1

If you need to manipulate a filename in an attribute (as opposed to the name of an actual file), there's also the FilenamePartExtractor which lets you split a path and/or filename into its individual parts.

Probably it is not what I really need. Or am I wrong? I simply need rename the source file (e.g. C:\\Temp\\ABC.svg.gz) to destination file (C:\\Temp\\ABC.svgz+px). I think that I´m not able to do that via FilenamePartExtractor...

 

 

Userlevel 4
Probably it is not what I really need. Or am I wrong? I simply need rename the source file (e.g. C:\\Temp\\ABC.svg.gz) to destination file (C:\\Temp\\ABC.svgz+px). I think that I´m not able to do that via FilenamePartExtractor...

 

 

The FilenamePartExtractor will split up an attribute value (a string, basically) containing a filename, thereby allowing you to "re-construct" that filename to something else.

 

 

It won't touch the file, however. So if you need to rename an actual file, then no, the FilenamePartExtractor won't to that for you, unless you use it in conjunction with e.g. the FILECOPY writer, as suggested by @egomm

 

Badge +1

Thanks to all of you!

Reply