Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Making multiple directories

Posted on 2004-10-01
3
Medium Priority
?
170 Views
Last Modified: 2010-04-04
Hi, I would like to know what is the better method to use if I want to create multiple directories.
By multiple directories I mean I want to create something like "c:\a\b\c" if  "c:\a" does not exists.

The CreateDir() function is not working if the "a" dir is not existing. Anyone know a function able to do it?
0
Comment
Question by:ZaSz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Assisted Solution

by:mokule
mokule earned 600 total points
ID: 12202537
Hi,
ForceDirectories(NewDstPath);
0
 
LVL 26

Accepted Solution

by:
Russell Libby earned 600 total points
ID: 12202538

ForceDirectories can be used to create the multi-level directory structure.

function ForceDirectories(Dir: string): Boolean;

Description

DOS and Windows only allow directories to be created one at a time. For example, to create the C:\APPS\SALES\LOCAL directory, the APPS and SALES directories must exist before the LOCAL directory can be created. Use ForceDirectories to create a directory and all parent directories that do not already exist.

ForceDirectories returns True if it successfully creates all necessary directories, False if it could not create a needed directory.

Note:      Do not call ForceDirectories with an empty string. Doing so causes ForceDirectories to raise an exception.

You will just need to include the FileCtrl unit in your uses clause.

Regards,
Russell
0
 
LVL 1

Author Comment

by:ZaSz
ID: 12202610
You posted at same time, one gave more details and the other was quicker.

Splitted the points to 150 each.
Thanks a lot!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question