How do you rename a file?

One Star

How do you rename a file?

Hi,
I'm looking for a simple way to rename a file, say, "foo.tmp" to "foo.dat".

I have a process that writes out a delimited file which is then accessed by some other application. However, the file is created as soon as the job begins. I do not want the other application to access it until the whole file has been written out. To avoid premature access to the incomplete file, what we've done is create the file with a .tmp extension and then rename it at the end to, say, .dat extension.

I do not see something like a tFileRename. I could try to use tFileCopy followed by a tFileDelete but I need the 2 individual operations to be part of the same transaction. Any ideas?

Thanks,
Yuan

p.s. - I used tJavaFlex --> tFileOutputDelimited to create a large enough number of records that I can see an obvious time difference between when the file was created and when it was completedly written to.
Community Manager

Re: How do you rename a file?

Hello
I could try to use tFileCopy followed by a tFileDelete but I need the 2 individual operations to be part of the same transaction. Any ideas?

Don't need tFileDelete to delete the source file, there is a 'remove source file' option on tFileCopy, so only tFileCopy is enough for renaming the file and delete the source file.

Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How do you rename a file?

That's interesting! I did not review the tFileCopy enough to know that it had the option of removing the source file. I'll try it out.

Thanks,
Yuan

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog