Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I've a requirement to delete all the folders and sub-folders which are empty i.e folders with out files.
I tried with this tFilelist --> tFileExist --> tFileDelete with their respective global variables but nothing worked for me and workaround please suggest me.
Thanks in advance.
Hi
I would use one tFileList to iterate directory, and use another tFileList to iterate files in the current direcotry (including the sub-directory). There is a global variable ((Integer)globalMap.get("tFileList_1_NB_FILE")) that counts the total number of files found, if it is 0, means the directory is empty. The job looks like:
tFileList--iterate--tRunJob
tRunJob: call the child job, and pass current directory path to child job, please refer to
https://help.talend.com/reader/HavZ1pLN5PZ~FuTJY51TEQ/root
child job:
tFileList--iterate--tJava
|runIf--tFileDelite
Set the condition of runIf as:
((Integer)globalMap.get("tFileList_1_NB_FILE")) ==0
Please try and let me know if it works.
Regards
Shong