1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

DirectoryExists

unit
SysUtils
category
File Management Routines

declaration
function DirectoryExists(const DirName: string): Boolean;

description
Returns True if a specified directory exists.

If DirName specifies a full path name, DirectoryExists searches for the directory along the designated path. Otherwise, the DirName parameter is interpreted as a relative path name from the current directory.

example
var Dir : widestring;

if SelectDirectory('My message','d:\!gajba',Dir) then
showmessage('Folder selected ' + Dir);

//prepare code to use directory 'Dir',
//code ... code
//make sure Dir was not deleted!

if NOT DirectoryExists(Dir) then
begin
  ShowMessage('Ups, somebody deleted your folder?! Let's create it again!');
  ForceDirectories(Dir);
end;

in real code
Browse for Computers, Folders, Files and Printers
Use Delphi (and API) to display the directory structure of a computer and allow a user to select a folder without using the Common Dialog control. Plus: select a printer or network computer.

see also
SelectDirectory, GetCurrentDir, FileExists, ForceDirectories


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.