Check Folder Exist Else Create Linux

[Solved] Check Folder Exist Else Create Linux | Vb - Code Explorer | yomemimo.com
Question : linux command if directory exists

Answered by : clumsy-cassowary-psy7clm0s2ev

DIR="/etc/httpd/"
if [ -d "$DIR" ]; then ### Take action if $DIR exists ### echo "Installing config files in ${DIR}..."
else ### Control will jump here if $DIR does NOT exists ### echo "Error: ${DIR} not found. Can not continue." exit 1
fi

Source : https://www.cyberciti.biz/faq/check-if-a-directory-exists-in-linux-or-unix-shell/ | Last Update : Thu, 29 Oct 20

Question : check folder exist else create linux

Answered by : leonard

[[ -f <file> ]] && echo "This file exists!"
[ -f <file> ] && echo "This file exists!"

Source : https://devconnected.com/how-to-check-if-file-or-directory-exists-in-bash/ | Last Update : Thu, 03 Mar 22

Answers related to check folder exist else create linux

Code Explorer Popular Question For Vb