1. Computing
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?

©2013 About.com. All rights reserved.