如何判断目录是否存在?(5分)

  • 主题发起人 主题发起人 d_dman
  • 开始时间 开始时间
下例是dos中判断目录是否存在的最简单的方法, 不知windows下还是否有效?
var
h: integer;
begin
h:=fileopen('NeedDetectedPath/nul',fmOpenRead);
if h>=0 then
begin
fileclose(h);
showmessage('Path exist');
end
else
showmessage('Path not exist');
 
DirectoryExists determines whether a specified directory exists.
Unit
FileCtrl
Category
file management routines
function DirectoryExists(Name: string): Boolean;
Description
Call DirectoryExists to determine whether the directory specified by the Name parameter exists. If the directory exists, the function returns True. If the directorydo
es not exist, the function returns False.
If a full path name is entered, DirectoryExists searches for the directory along the designated path. Otherwise, the Name parameter is interpreted as a relative path name within the current directory.
 
funciton DirectoryExists(s : string) :boolean;
 
我自己找到了,你们每人都得一点吧!
谢谢!
 
后退
顶部