| 1 |
#!/bin/csh |
| 2 |
# |
| 3 |
# This script is to guarantee that a directory exists. It will only |
| 4 |
# make a new directory at the last level in a hierarchy, so don't |
| 5 |
# expect it to go down a full path. |
| 6 |
# |
| 7 |
# Usage: createdirectory <directory> |
| 8 |
|
| 9 |
if ($1 == "") then |
| 10 |
echo "Usage: createdirectory <directory>" |
| 11 |
exit 1 |
| 12 |
endif |
| 13 |
|
| 14 |
if (-e $1) then |
| 15 |
exit 0 |
| 16 |
endif |
| 17 |
|
| 18 |
echo Directory $1 does not exist. Trying to create $1. |
| 19 |
mkdir $1 |
| 20 |
|
| 21 |
if ($status != 0) then |
| 22 |
echo Unable to create $1 |
| 23 |
endif |
| 24 |
|
| 25 |
exit $status |