Scenario:
Path: /users/country/CAN/DateFolder1 more directories /users/country/CAN/DateFolder2 /users/country/CAN/DateFolder3
DateFolder1 and DateFolder2 are empty.
I want to delete datefolder when they are empty, but i can't mention the datefolder name exclusively
using below, i am able to delete directory till the path i mention, but need logic to search. for inner directories only after the specified path.
FileSystemUtils.deleteRecursively(Paths.get("/Users/country/CAN/"));



To delete empty folders inside /users/country/CAN without recurcy:
Update. For example root folder is /users/country and we need to remove all empty folders at a certain depth from root. In case from your comment depth=2. I used most simple IO as task is simple. If you want NIO you can find about Files.walk(Path path, int depth).
Update 2. Example with NIO.