One Star

Rename output file

Simple ask, looking for an example on renaming output files at the end of iteration (I'm looping through multiple files and need multiple output files with a similar name. i.e. 123.xls to 123_out.xls)
Haven't seen a decent example digging through the forums...
Seems like a simple need that could be accomplished without script.
9 REPLIES
One Star

Re: Rename output file

have a look at tFileCopy and set rename and delete source checkbox
One Star

Re: Rename output file

Unless I'm missing something (and maybe I am, I'm new to the tool) there is no set rename.
Just values to set the file to be copied and the destination folder for it to be copied to. It would sense to have a field to set the destination name as well.
For additional context here's what I want to do
------------------------------
| in file | outfile |
------------------------------
| 123.xls |123_out.xls |
| abc.xls |abc_out.xls |
------------------------------
I guess the alternative would be to write the file with the right name when the flow is initiated, but I'm not seeing a logical way to send a variable file name to tFileOutputExcel for example.
Community Manager

Re: Rename output file

Hi
Does the tFileCopy fit your need? "out" is a fixed value or it should be a dynamical value?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Rename output file

No. It does tFileCopy does not. It needs to be a dynamic value. I'm processing multiple files and need multiple outputs with similar but different names.
One Star

Re: Rename output file

here is a screenshot of a tFileCopy-Componentview which I use to rename a file. The labels are in German, but you may find it helpful anyway. Notice, that some fields become visible only if you set the checkboxes which activate them ("umbenennen" => "Zieldateiname").
One Star

Re: Rename output file

if you know Java you can try file.rename method to rename the files.
One Star

Re: Rename output file

Looking at Blackfox's post, there's a delta in functionallity between the Perl version of the tFileCopy vs the Java version. It would appear the Java version supports the rename functionality and the Perl does not. Unfortunately I need it in the Perl version for some of the pivot table functions that are not in Java version.
This is for R4.1.2.
Anyway to fix or log a bug?
Community Manager

Re: Rename output file

Hi
It is not a bug, we can say it is a feature in Perl version. There is no relationship between Java project and Perl project, they are developed separately. I suggest you to use Java project because there are more than features than Perl version, and more Java developers and users here.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Rename output file

Interesting POV.
2 followup questions then:
1) Is there a developer guide. I'll take a swing at fixing it, just for giggles.
2) Is there a Java equivalent to tPivottoRows other than tUnpivotRow which hasn't been updated recently. I need to blow out an Xcel table into key value pairs so I can do historical analysis.