Skip to main content
Solved

How to change filename extension via FME?

  • December 13, 2017
  • 9 replies
  • 149 views

lazarlubomir
Contributor
Forum|alt.badge.img+7

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

Best answer by ebygomm

You can do this using the filecopy writer in fme

View original
Did this help you find an answer to your question?

9 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • December 13, 2017

You can do this using the filecopy writer in fme


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • December 13, 2017

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


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • December 13, 2017
ebygomm wrote:

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

 

 


redgeographics
Celebrity
Forum|alt.badge.img+48
erik_jan wrote:

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

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

 

 


lazarlubomir
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • December 14, 2017

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?


david_r
Evangelist
  • December 14, 2017

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.


lazarlubomir
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • December 14, 2017
david_r wrote:

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...

 

 


david_r
Evangelist
  • December 14, 2017
lazarlubomir wrote:
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

 


lazarlubomir
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • December 15, 2017

Thanks to all of you!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings