Reputation: 3
how to check whether a directory named such as "2012-02-06T00_17_25_25-06_00" exists inside a particular directory ? here the directory name is a combination of date and time.
Upvotes: 0
Views: 877
Reputation: 12486
If you want to find a directory needle
that exists anywhere inside a parent directory /haystack
(including as a sub-sub-sub... directory), you could try
find /haystack | grep /needle/
Upvotes: 0
Reputation: 182619
You can just test it:
path=...
name=2012-02-06T00_17_25_25-06_00
if [ -d "$path/$name" ]
then
echo "$path/$name exists and it's a directory"
fi
Upvotes: 2