Hello API folks!
I have a need to create a directory structure where sometimes the parent subdirectories MAY or may NOT exist. I know that I can perform this from a DOS command prompt, plus, I've also tried to call the CreateDirectoryEx() function which will allow me to enherit the rights from a template path. However, this will NOT work if the new directory contains parents that do not exist.
Is there another API call that I am not aware of that I can use? Or do I have to traverse the path and create each non-existant folder?
P.S. I need to inheret the right for a template directory.
**************************
FUNCTION CreateDirectory( m.lcTemplateDirectory, m.lcDirectory )
**************************
DO CASE
CASE LEFT( m.lcDirectory, 2 ) == "\\" && UNC?
m.lcDirectory = STRTRAN( m.lcDirectory, "\\", "\\?\UNC\" )
CASE ( ":" $ m.lcDirectory ) && ordinary path
m.lcDirectory = "\\?\" + m.lcDirectory
ENDCASE
DECLARE SHORT CreateDirectoryEx IN WIN32API AS CreateDirectoryA ;
STRING @lpTemplateDirectory, ;
STRING @lpPathName, ;
STRING @lpSecurityAttributes
RETURN( ( CreateDirectoryA( @lcTemplateDirectory, @lcDirectory, NULL ) != 0 ) )