Mkdir function

G

Greg

Hi,

I'm trying to write a function that creates a directory & Subdirectories. I
can create a String say "C:/DirL1/DirL2/DirL3/" say but I dont know if DirL1
or DirL1/DirL2 exist. what I need is a recursive string function that will
test for the total directory String, if not test for the next level down and
so on until it gets to the root directory, and then create the directories
once true.

I suppose what I really need is a function that will take a directory string
and return the next level up

ie (stringfunc "C:/DirL1/DirL2/DirL3/") and return "C:/DirL1/DirL2/" and so on

Hope this makes sense.

Thanks for any help
 
S

Stuart McCall

Greg said:
Hi,

I'm trying to write a function that creates a directory & Subdirectories.
I
can create a String say "C:/DirL1/DirL2/DirL3/" say but I dont know if
DirL1
or DirL1/DirL2 exist. what I need is a recursive string function that will
test for the total directory String, if not test for the next level down
and
so on until it gets to the root directory, and then create the directories
once true.

I suppose what I really need is a function that will take a directory
string
and return the next level up

ie (stringfunc "C:/DirL1/DirL2/DirL3/") and return "C:/DirL1/DirL2/" and
so on

Hope this makes sense.

Thanks for any help

Take a look at this. It does exactly what you want AFAICT.

http://www.smccall.demon.co.uk/Strings.htm#CreatePath
 
Top