sorry for that odd title. I didn't know how to word it the right way.
I'm trying to write a script to filter my wiki files to those got directories with the same name and the ones without. I'll elaborate further.
here is my file system:
what I need to do is print a list of those files which have directories in their name and another one of those without.
So my ultimate goal is getting:
with dirs:
Docs
Eng
Python
RHEL
To_do_list
articals
without dirs:
orphan.txt
orphan2.txt
orphan3.txt
I managed to get those files with dirs. Here is me code:
getname () {
        file=$( basename "$1" )
        file2=${file%%.*}
        echo $file2
        }
for d in  Mywiki/* ; do
    if [[ -f $d ]]; then
        file=$(getname $d)
        for x in  Mywiki/* ; do
            dir=$(getname $x)
            if [[ -d $x ]] && [ $dir == $file ]; then
            echo $dir
            fi
        done
    fi
done
but stuck with getting those without. if this is the wrong way of doing this please clarify the right one.
any help appreciated. Thanks.

 
     
     
    