Check if a directory exists in a shell script
Use the following conditions to check if a “directory exists” in a shell script if [ -d $DIRECTORY ] then rm -rf $DIRECTORY fi or if [ ! -d $DIRECTORY ] then mkdir $DIRECTORY Test case: Assume “testdir” is the file to check. The below script will check the file and if it exists, remove … More Check if a directory exists in a shell script