Bash check if a directory exists
To check if a directory exists in bash, use
1 2 3 4 |
if [[ -d "/path/to/directory/" ]] then echo "Directory found." fi |
To check for absense of a directory, use !
1 2 3 4 |
if [[ ! -d "/path/to/directory/" ]] then echo "Directory not found." fi |
See bash