Solved

How to find out if a dir exists?

Posted on 1998-09-20
1
488 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
ID: 1340340
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi OLE Error 8 93
QRReport  TQrmemo vertical stretching 1 42
Find and Replace Stream with 0s 8 56
Moving (cutting/pasting) controls in a TTabbedNotebook... 7 27
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
A short film showing how OnPage and Connectwise integration works.

919 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

18 Experts available now in Live!

Get 1:1 Help Now