Saturday 28 December 2013

Check if a directory exists in Unix

In Unix, you can check if a certain directory exists or not using -d

Eg:

if [-d $directory_name]
then
       execute_some_commands
fi

In the variable $directory_name you specify the name of the directory. If the directory exists, then the if loop executes and the commands would be executed. 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker