Identify double occurrence of directory names
Dear All,
I am looking for a shell command that will identify all directories, each of which having the same name as one of its subdirectory. For example: Code:
/as/df/gh/sq12/sq12 Code:
/fgd/hgtre/gtsrew/hgt/mydirectory/mydirectory |
find <root> -type d | grep -E '(/[^/]+)(/.+)?\1(\/|$)'
works for me, but probably not perfect |
Thanks,
and how can I filter from these results directories with certain patterns such as dir1/dir2/dir3/mydir/mydir/ (the name starts with 'myd' Thanks again |
All times are GMT -5. The time now is 04:19 AM. |