How do I find a folder in Linux?

How do I find a folder in Linux?
Answer
How to check if a directory exists in Linux
  1. One can check if a directory exists in a Linux shell script using the following syntax: [ -d “/path/dir/” ] && echo “Directory /path/dir/ exists.”
  2. You can use ! to check if a directory does not exists on Unix: [ ! -d “/dir1/” ] && echo “Directory /dir1/ DOES NOT exists.”
 

Tìm kiếm

Back
Top