Phan Thị Thùy Dương
Member
How do I find a folder in Linux?
Answer
How to check if a directory exists in Linux
Answer
How to check if a directory exists in Linux
- One can check if a directory exists in a Linux shell script using the following syntax: [ -d “/path/dir/” ] && echo “Directory /path/dir/ exists.”
- You can use ! to check if a directory does not exists on Unix: [ ! -d “/dir1/” ] && echo “Directory /dir1/ DOES NOT exists.”