in reply to Is there a -e test for directories, like there is for files?
Check out mkdir; specifically the -p option.
You can see if a directory exists with -d. This tells you with a single command whether the specified path exists, and is a directory. Of course, you would also presumably need to use -f to make sure a file with the same name does NOT exist:
# Assuming $path contains the full pathname of the file/directory if (-d $path) { # It's an existing directory } elsif (-f $path) { # It's an existing file }
|
|---|