tFileArchive Behavior

Four Stars

tFileArchive Behavior

I'm new to Talend as of 2.3.2 and was attempting the following simple scenario:
1) Fetch a number of files with tFTPGet (this part was successful)
2) After successful completion, use tFileArchive to zip up the five txt files into one archive using a date-time stamp.
Upon execution, I'm experiencing the following exception:
Starting job GetFiles at 14:09 20/05/2008.
Exception in component tFileArchive_1
java.io.FileNotFoundException: C:\Documents\Manufacturers\ACME\ACME Data Stage\ACME_Data_2008-05-20.zip (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at texasinstruments.getfiles.GetFiles.tFileArchive_1Process(GetFiles.java:294)
at texasinstruments.getfiles.GetFiles.tFTPGet_1Process(GetFiles.java:219)
at texasinstruments.getfiles.GetFiles.runJobInTOS(GetFiles.java:447)
at texasinstruments.getfiles.GetFiles.main(GetFiles.java:361)
Job GetFiles ended at 14:12 20/05/2008.
I was under the impression that tFileArchive creates the archive file on the fly. According to the exception it appears as though the archive has to exist beforehand. There is no documentation on tFileArchive as of the latest components guide, nor can I find it anywhere.
Any guidance would be appreciated.
Community Manager

Re: tFileArchive Behavior

Hello andybrown
Yes, you are right. Currently, it will throws exception if the folder doesn't exist. I have reported a 3855.
To avoid this problem, you should create the folder first and select it in TOS.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: tFileArchive Behavior

Hello andybrown
Yes, you are right. Currently, it will throws exception if the folder doesn't exist. I have reported a 3855.
To avoid this problem, you should create the folder first and select it in TOS.
Best regards
shong

Thanks for the response. Did you mean "it will throw the exception if the 'archive' file doesn't exist"? The folder "ACME Data Stage" actually does exist in my scenario. It is the file named "ACME_Data_2008-05-20.zip" that does not exist. I just want to make sure that is what you meant.
Regards.
Community Manager

Re: tFileArchive Behavior

Hello
Did you mean "it will throw the exception if the 'archive' file doesn't exist"? The folder "ACME Data Stage" actually does exist in my scenario. It is the file named "ACME_Data_2008-05-20.zip" that does not exist.

I mean it will throw exception if the archive file folder doesn't exist.(see the screenshot)
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: tFileArchive Behavior

Hello
Did you mean "it will throw the exception if the 'archive' file doesn't exist"? The folder "ACME Data Stage" actually does exist in my scenario. It is the file named "ACME_Data_2008-05-20.zip" that does not exist.

I mean it will throw exception if the archive file folder doesn't exist.(see the screenshot)
Best regards
shong

Got it. Thanks.
One Star

Re: tFileArchive Behavior

Hi,
How do i create a archive file with data time stamp automatically using the tfilearchive component. My component settings are:
Directory : "C:\Test\*.xls"
Archive File: "C:\Done\new.zip"
How do i get my component to zip file with data time stamp, so tht it doesn't overwirte the zip everytime i run this component.
Community Manager

Re: tFileArchive Behavior

Hello
How do i get my component to zip file with data time stamp, so tht it doesn't overwirte the zip everytime i

You can set the archive file name like this, for example:
"C:\Done\"+TalendDate.formatDate("yyyy-MM-dd HH-mm-ss",TalendDate.getCurrentDate())+" new.zip"

Best regards

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

Re: tFileArchive Behavior

ThankQ Shong.
One Star

Re: tFileArchive Behavior

Hi, How can I archive an individual file????? without the folder.
I have put some number of files in my folder and I want to archive the files in separate zip files.
Currently, in my knowledge, tFileArchive is only archiving the directory, right????
Thanks

Re: tFileArchive Behavior

Untick the All Files option and add the file masks for the files you want to zip.
The mask can be for a specific type of file:
"*.txt"
or and individual file:
"samplefile.txt"

Regards
Brandon
One Star

Re: tFileArchive Behavior

Thanks Brandon,
It's working now,
now one step further,
is there any way to move and archive a file????
like the "MOVE" command in dos???
I want to archive my file and save it in archived folder then delete the original file.
Thanks in advance.
Community Manager

Re: tFileArchive Behavior

Hi
You can try the tFileCopy component.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: tFileArchive Behavior

Hi Kyaw Lwin Phyo,
shong description is just fine...you schould use first tFileArchive to archive files, you don't need to move the archive file as soon as you can create it directly in destination folder, but in case, you need to move it explicitly you use tFileCopy where is option to delete source file after copy (here is one thing which could break you into problem if you need to keep the date of file same as source), and then you just use tFileDelete to delete source files.
Ladislav
One Star

Re: tFileArchive Behavior

Hi,
I have one more question.
I want to give my file's name with a time stamp
It will be like "filename_yyyyMMdd_HHmm.dat"
But I have to find this file again in the job so, I want to store the "yyyyMMdd_HHmm" value in a context or variable.
and assign that context or variable to the file name.
Can you direct me how it can be done???
I've tried making a context of type string whose value is TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())
But when i run it i got a file not found exception (I'm to create a file not find for the first time).
and I think the context returns as a string of "TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())" not the actural date time value.
Thank You.

Re: tFileArchive Behavior

This has been on answered on you other thread
http://www.talendforge.org/forum/viewtopic.php?id=17135
Smiley Happy
Regards,
Brandon