Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating subfolders as well as its parents
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Creating subfolders as well as its parents
Divers
Thread ID:
00188147
Message ID:
00188147
Vues:
67
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform