Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count of files in a directory

Hi Team

In a directory i am having different files like txt files csv files and text files

is their any component in talend to find the count of files accornding to extension

or what is the procedure we need to follow to achieve the same through talend without using tFilelist component

 

Thanks

Deepthi

Labels (1)
14 Replies
TRF
Creator III
Creator III

Hi,

If you don't want to do it using tFileList, I'm afraid you need to code it using a tJava component.

Regards,

sbxr
Contributor III
Contributor III

FYI @TRF @shong @akash 

 

How to get the files count from a directory based on date .

for example i want the count files present i a directory which is having date modified greater than 30 day.

 

Thanks.

TRF
Creator III
Creator III

tFileList + tFileProperties + tJavaRow to compute the number of days from the modified date + tFilterRow to exclude undesirable rows

sbxr
Contributor III
Contributor III

i am using the below logic, but dont know how to use in java code can you please help me with this so that i can get the count

(TalendDate.getCurrentDate().getTime()-(out1.mtime+86400000*10))>0
TRF
Creator III
Creator III

tSetGlobalVar--(onSubJobOk)--tFileList--(iterate)--tFileProperties---tFilterRow

tSetGlobalVar is here to define the value to be compared with mtime for the current file (2592000000 which is 30 days converted to milliseconds).
For the tFilterRow condition add a line with:
Input column=out1.mtime
Function=empty
Operator=less than
Value=(Long)globalMap.get("lastModified")
sbxr
Contributor III
Contributor III

Not able to get the count of files using the scenario you explained please create a demo job and explain.'

 

Thanks, @TRF 


fileproperty.PNG
JOb_Pic.PNG
tfilterrow.PNG
TRF
Creator III
Creator III

Well, what appends when you launch the job?

sbxr
Contributor III
Contributor III

the job runs but nothing happens not seeing the count, please help


Result.PNG
sbxr
Contributor III
Contributor III

FYI @shong @TRF