Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating subfolders as well as its parents
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00188147
Message ID:
00188180
Views:
19
>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?
>

The native VFP MKDIR will create a subtree, and under NT, directory rights will inherit downwards by default. You could then assign security after creation.


>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 ) )
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform