• Index
  •  » Talend Enterprise Data Integration » General questions
  •  » Detect an archived file or Excel automatically

#1 2012-03-27 17:21:37

PM_param
Member
Registered: 2012-02-22
Posts: 44

Detect an archived file or Excel automatically

Hello,

My job use several file types: txt, archive or Excel. It must be able to automatically detect if it's an archive or an Excel file.
Sometimes files have an extension ". Txt" then it's archive ...

Is there a component Talend to detect this?
Otherwise how JAVA can I use?

Thank you,
Carole

Offline

#2 2012-03-28 07:18:01

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Detect an archived file or Excel automatically

Hi

Link tFileProperties with tFilterRow.
Check "Advanced mode" of tFilterRow.
Set expression of basename.
Get extension at the right of "." .

Code:

(input_row.basename.substring(StringHandling.INDEX(input_row.basename,".")+1)).equals("txt")

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-03-28 09:45:27

PM_param
Member
Registered: 2012-02-22
Posts: 44

Re: Detect an archived file or Excel automatically

Hi,

The problem is that the files do not always have the right extension. So I would need an equivalent of the "file-i" on unix.
Does it exist in talend or java?

Thank you,
Carole

Offline

#4 2012-03-28 10:01:25

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: Detect an archived file or Excel automatically

Hi Carole

There isn't a component equivalent to "file -i".
You can only use tFileProperties to get the basename of each file.
And use tFilterRow or tMap to filter the extension.

Regards,
PEDRO


Only Paranoid Survive.

Offline

  • Index
  •  » Talend Enterprise Data Integration » General questions
  •  » Detect an archived file or Excel automatically

Board footer

Powered by FluxBB