Solved

How to find out if a dir exists?

Posted on 1998-09-20
1
487 Views
Last Modified: 2010-04-06
I know you can use FileExists to find out if a file exists, but is there a similar way to find out if a directory exists? I can't seem to find it.
0
Comment
Question by:ripcord
1 Comment
 
LVL 20

Accepted Solution

by:
Madshi earned 50 total points
Comment Utility
ripcord,

function fio_DirExists(dir: string) : boolean;  
// no backslash at the end of "dir", please...
var i1 : integer;
begin
  i1:=GetFileAttributes(pchar(dir));
  result:=(i1<>-1) and (FILE_ATTRIBUTE_DIRECTORY and i1<>0);
end;

Regards, Madshi.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now