I would like to know if a particular folder is present or not. I used the following command
find /mnt/md0/ -maxdepth 1 -name 'dcn'||'DCN'
I want to know if folder name is DCN or dcn .
How would I do this ?
findlinux
I would like to know if a particular folder is present or not. I used the following command
find /mnt/md0/ -maxdepth 1 -name 'dcn'||'DCN'
I want to know if folder name is DCN or dcn .
How would I do this ?
Best Answer
You're looking for the option
-iname
, which stands for "ignore case" onGNU find
along with the option-type d
for selecting only directories.For more a detail explanation on find switches you consult explainshells.com's explanation of find. (This will match any case:
dcn
,DcN
,DCn
)Edit 1:
As state in comment by Olivier Dulac to use with non GNU find or old find version you could use :see this answer to have a real compatibility with non GNU and old find version