Midhun Midhun - 3 months ago 9
Bash Question

Find directories not containing a file recursively

I want to find the directories which does not having any files.Below is the sample script which will write a sample file with all the directory names.

CURRENT_DATE=`date +'%d%m%Y'`
Year=`date +%Y`
cd $File_Path
echo $Year
find /bishare/DLSFTP/$Year* -type d -exec ls -dlrt {} + > $Temp_Path/Vendors_Data_$CURRENT_DATE.txt


If I understand well, you're looking for empty directory.

You can use the -empty parameter of find command for that:

find /bishare/DLSFTP/$Year* -type d -empty