var
f: string;
begin
f := ;
if not FileExists(f) then
begin
end;
end;
var
dir: string;
begin
dir := ;
if not DirectoryExists(dir) then
begin
end;
end;
var
f: string;
begin
f := ;
Windows.DeleteFile(PChar(f));
end;
var
dir: string;
begin
dir := ;
RemoveDir(dir);
RemoveDirectory(PChar(dir));
end;
var
dir: string;
begin
dir := GetCurrentDir;
ShowMessage(dir);
end;
var
dir: string;
begin
dir := ;
if SetCurrentDir(dir) then
ShowMessage(GetCurrentDir);
ChDir(dir);
SetCurrentDirectory(PChar(Dir));
end;
var
dir: string;
b: Byte;
begin
b := ;
GetDir(b,dir);
ShowMessage(dir);
end;
var
OldName,NewName: string;
begin
OldName := ;
NewName := ;
if RenameFile(OldName,NewName) then
ShowMessage();
SetCurrentDir();
OldName := ;
NewName := ;
if RenameFile(OldName,NewName) then
ShowMessage();
end;
var
dir: string;
begin
dir := ;
if not DirectoryExists(dir) then
CreateDir(dir);
CreateDirectory(PChar(dir),nil);
dir := ;
ForceDirectories(dir);
end;
var
dir: string;
begin
dir := ;
RemoveDir(dir);
RemoveDirectory(PChar(dir));
end;
var
FileName: string;
i: Integer;
begin
FileName := ;
i := FileCreate(FileName);
if i> then
ShowMessage( + IntToStr(i))
else
ShowMessage();
end;
var
s: string;
i: Integer;
begin
s := ;
i := GetFileVersion(s);
ShowMessage(IntToStr(i));
end;
var
r: Real;
s: string;
begin
r := DiskSize();
r := r///;
Str(r::,s);
s := + s + ;
ShowMessage(s);
r := DiskFree();
r := r///;
Str(r::,s);
s := + s + ;
ShowMessage(s);
end;
var
FileName,Dir,s: string;
begin
FileName := ;
Dir := ;
s := FileSearch(FileName,Dir);
if s<> then
ShowMessage(s)
else
ShowMessage();
end;
var
sr: TSearchRec;
Attr: Integer;
s: string;
List: TStringList;
begin
s := ;
Attr := faAnyFile;
List := TStringList.Create;
if FindFirst(s,Attr,sr)= then
begin
repeat
List.Add(sr.Name);
until(FindNext(sr)<>);
end;
FindClose(sr);
ShowMessage(List.Text);
List.Free;
end;
var
FileName: string;
Attr: Integer;
begin
FileName := ;
Attr := FileGetAttr(FileName);
ShowMessage(IntToStr(Attr));
Attr := FILE_ATTRIBUTE_READONLY or FILE_ATTRIBUTE_HIDDEN;
if FileSetAttr(FileName,Attr)= then
ShowMessage();
end;
var
FileName: string;
ti: Integer;
dt: TDateTime;
begin
FileName := ;
ti := FileAge(FileName);
ShowMessage(IntToStr(ti));
dt := FileDateToDateTime(ti);
ShowMessage(DateTimeToStr(dt));
end;
轉自萬一老師:http://www.cnblogs.com/del/archive/2007/12/12/992043.html
http://www.cnblogs.com/del/archive/2007/12/12/992462.html