1

What command can be used to check if a directory does or does not exist, within a shell script?

ayyappa
  • 41
  • 2
  • 4
  • 2
    Next time, dear @ayyappa, have a look at the suggested older posts when you type your title ;-) – Alfe Feb 27 '14 at 11:06

1 Answers1

1
if [ -d "/path/to/dir" ]
then
      echo "Directory /path/to/dir exists."
else
      echo "Error: Directory /path/to/dir does not exists."
fi
loki
  • 387
  • 2
  • 8