www.icetips.com  Icetips Utilities Documentation 11/30/2010    

Utility Class: CreateDirectories

Previous  Top  Next  


Prototype:  (String pDirectories, String pStartDir),Long

 

pDirectoriesString containing the path to create below the start directory.  Any directory or directories that do not exist will be created by the method.  The string does not need to start with a backslash.

 

pStartDirString containing the full path to the start directory.  This directory must exist.

 

ReturnsThe number of directories created. 

 

This is a very powerful function that will create as many nested directories as you want. 

 

Example:

 

CurrentUser   CString(101)

ITU           ITUtilityClass

Code

ITU.CreateDirectories('Data\Temp',Path())

CurrentUser = 'John'

ITU.CreateDirectories('User\' & CurrentUser & '\Data\Temp\Stuff',Path())

 

In the first example, if Path() is C:\Clarion this would result in C:\Clarion\Data\Temp to be created.  In the second example, if Path() is C:\Clarion this would result in C:\Clarion\John\Data\Temp\Stuff to be created.

 

This method is extremely useful when multiple levels of directories is needed.  If any of the directories in pDirectories does not exist, it will be created.  Directories in pStartDir will not be created, i.e. pStartDir must exist.

 

Note: In Beta 2, there was potentially dangerous code in this method that changed the path using SetPath()  This code has been removed in the Beta 3 release and this method should be perfectly safe. 

 

 

 



Direct link to this page: http://www.icetips.com/manuals/utilities/createdirectories_utility.htm