Suppose I have a dir tree like this:
ROOTDIR
└--SUBDIR1
└----SUBDIR2
└----SUBDIR3
I am looking for a command such that when I input:
$ [unknown command] ROOTDIR
The whole dir tree can be deleted if there is no file but only dirs inside the whole tree. However, say if there is a file called hello.pdf under SUBDIR1:
ROOTDIR
└--SUBDIR1
└--hello.pdf
└----SUBDIR2
└----SUBDIR3
Then the command must only delete SUBDIR2 and below.