tFileList & tFileDelete - check and delete empty folders

One Star

tFileList & tFileDelete - check and delete empty folders

Hello,
Is there a way to check a directory's subfolders if they are empty, and have them deleted?
Right now I check all the files in all subfolders and delete them if they are older than 24hours
But after that, Id like to also delete subfolders that are empty since all their files are older than 24hours and hence deleted.
Regards
Moderator

Re: tFileList & tFileDelete - check and delete empty folders

Hi,
Is your file named by date? 
Here is an option "Delete Folder" in tFtpDelete component.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: tFileList & tFileDelete - check and delete empty folders

Unfortunately no, our files are named according to a certain key. Also, it is not through FTP.
Five Stars

Re: tFileList & tFileDelete - check and delete empty folders

Hej Junmilsso,

i know the post ist old, but maybe someone have the same issue as you.
I found a solution, you can use the tSystem-Component and insert the following Code:

//with context-variable
"ROBOCOPY " + context.strArchiv_Folder_Path + " " + context.strArchiv_Folder_Path + " /S /MOVE"

//with fixed-value
"ROBOCOPY //muc1-vm0137/Scripte$/EXP/_IPAM_2.0/_archiv //muc1-vm0137/Scripte$/EXP/_IPAM_2.0/_archiv /S /MOVE"

The script will delete all empty Folder under your Directory.

 

 

Greetings

Magerquark

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog