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

x
?
Solved

How to find out if a dir exists?

Posted on 1998-09-20
1
Medium Priority
?
501 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 200 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

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…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

885 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