First, use the action "Get subfolders in folder" where you specify your base folder.
Then use any loop, for example a "for each"-loop and iterate through all the subfolders
Inside that loop, you can use "Get files in folder" and use the file filter by *.txt.
The you can use an IF-condition and check if the files from the "Get files in folder" action count is = 0,
and then finally delete that folder