Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Making multiple directories

Posted on 2004-10-01
3
Medium Priority
?
171 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
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

972 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