Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating subfolders as well as its parents
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Creating subfolders as well as its parents
Miscellaneous
Thread ID:
00188147
Message ID:
00188147
Views:
69
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 ) )
Juan L. Romero
gcandela@javanet.com
Next
Reply
Map
View

Click here to load this message in the networking platform