I have a project tree like that.
after running find command with the -no -empty option, i am able to have a list of non empty directory
DO_MY_SEARCH="find . -type d -not -empty -print0"
MY_EXCLUDE_DIR1=" -e NOT_IN_USE -e RTMAP -e NOT_USEFULL "
echo " " > $MY_TEMP_RESULT_1
while IFS= read -r -d '' file; do
CURRENT_DATA=$file
echo $CURRENT_DATA | grep -v ${MY_EXCLUDE_DIR1} >> $MY_TEMP_RESULT_1
done < <($DO_MY_SEARCH)
I have some duplicate project :
1 : project some_project
/dir_a/dir_1/dir_1-2/dir_1-2-1/dir_1-2-1-1/some_project
and
/dir_a/dir_1/dir_1-4/some_project
and
/dir_a/dir_4/dir_4-1/dir_4-1-1/dir_4-1-1-1/some_project
2 : project dir_1-3-2-1-1
/dir_a/dir_1/dir_1-3/dir_1-3-2/dir_1-3-2-1/dir_1-3-2-1-1
and
/dir_a/dir_7/dir_7-1/dir_7-1-1/dir_7-1-1-1/dir_7-1-1-1-1/dir_1-3-2-1-1
3 : project another_project
/dir_a/dir_6/dir_6-1/another_project
and
/dir/a/dir_8/another_project
How to get the duplicate leaf name :
some_project
dir_1-3-2-1-1
another_project
Any help is welcome.