![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem when test to see if directory exists | trivektor | Shell Programming and Scripting | 3 | 08-11-2008 10:48 PM |
| How can I check if directory exists in a makefile | zivsegal | UNIX for Dummies Questions & Answers | 2 | 09-10-2007 12:12 AM |
| how to check if masked directory exists? | philplasma | Shell Programming and Scripting | 4 | 05-30-2007 05:46 PM |
| rm: Unable to remove directory xxxx/xxxx: File exists | deejay | UNIX for Dummies Questions & Answers | 1 | 11-06-2005 09:17 PM |
| check if directory exists | jerardfjay | Shell Programming and Scripting | 2 | 06-13-2005 11:26 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Directory exists
Hi all,
Sorry about this i'm sure this is a very silly question hence an easy answer but: I'm trying to write a script, part of which I want to check if a directory exists, if it doesn't then create it. Thanks for your help Tez |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
-d option
search the forum. |
|
#3
|
|||
|
|||
|
From the manual for 'test':
Code:
[(1) User Commands [(1)
NAME
test - check file types and compare values
SYNOPSIS
test EXPRESSION
[ EXPRESSION ]
[ OPTION
-d FILE
FILE exists and is a directory
-e FILE
FILE exists
Code:
MY_DIR="ZZZ" if [ ! -d $MY_DIR ] ; then mkdir $MY_DIR fi |
|
#4
|
|||
|
|||
|
That works thanks.
|
|||
| Google The UNIX and Linux Forums |