Find if a directory exist from a list of the path

Hello,

i want to script on sh to check from a path if the directory exist and isn't empty.

I explain:

path is : /aaa/bbb/ccc/ccc_name/ddd/
Where the cccc_name is in a list, so i think it's $1

My command

find -name /aaa/bbb/ccc/$1/ddd/

didn't work because my $1 is the same and not from a list

Could you help for that

Thanks

Try these below and do more R&D with your current work:

to check empty dir:

if find /path/to/some/dir -maxdepth 0 -empty | read v; then echo "Empty dir"; fi

OR check: This in UNIX(dot)com

to check dir existence:

if [ -d "$DIRECTORY" ]; then
 # your code!
fi

Given this path list

ccc_name
cdd_name
cee_name

in file, you can assemble all the paths in one variable with

while read TMP; do PVar+="/aaa/bbb/ccc/$TMP/ddd "; done <file
echo $PVar 
/aaa/bbb/ccc/ccc_name/ddd /aaa/bbb/ccc/cdd_name/ddd /aaa/bbb/ccc/cee_name/ddd

and use this variable for the find command:

find $PVar -empty

Hello

thanks for your reply,

My Problem now is that all my paths are in a virtual list.

I need just the command like :

echo "$params"|while read param
do
{
echo $params
#if [ -d "/var/mqm/qmgr/"$params"ssl/" ]; then
#       echo "The directory exists"
#else
#       echo "Does not exist"
#fi
}
done

But it make more loop that name in the list

thanks

What is a "virtual list"?
And - if you read the param variable, you should use the param variable within the loop, not params .

Hello,

Thanks

it works nice