文件与目录
2006-02-04 13:51:17 来源:WEB开发网strPcopy(BaseDbName,A_BaseName);
gettemppath
setlength(tmpFile,MAX_PATH);
GetTempFileName(ExtractFilePath(application.ExeName),'',0,pchar(tmpFile));
================================== 目录与文件 =======================================
uses FileCtrl;
(1) 判断路径是否存在
function DirectoryExists(Name: string): Boolean;
(2)对一个全路径文件进行分割
PRocessPath (const EditText:string; var Drive:Char; var DirPart:string; var FilePart:string)
(3)创建一不存在的路径
function ForceDirectories(Dir: string): Boolean;
(4) 选择一个目录
function SelectDirectory(const Caption: string; const Root: WideString; out Directory: string): Boolean;
function SelectDirectory(var Directory: string; Options: TSelectDirOpts; HelpCtx: Longint): Boolean;
uses Sysutils;
(1)function ExtractFileDrive(const FileName:string):string; //取得路径文件名中的驱动器名
function ExtractFileDir(const FileName: string): string; //取得路径文件名中的路径名 (最后没有"\")
function ExtractFilePath(const FileName: string):string; //取得路径文件名中的路径名 (最后 有 "\")
function ExtractFileExt(const FileName: string): string; //取得路径文件名中的扩展名 (.XXX)
function ExtractFileName(const FileName: string):string; //取得路径文件名中的文件名 (AAA.XXX)
(2)function CreateDir(const Dir: string): Boolean;
function GetCurrentDir: string;
function RemoveDir(const Dir: string): Boolean;
function SetCurrentDir(const Dir: string): Boolean;
function ExpandFileName(const FileName: string): string;
(3) MKDir chDir GetDir RmDir DiskFree DiskSize FileSize
(4) fileGetAttr fileSetAttr fileAge fileGetDate fileSetDate fileDateToDateTime DateTimeToFileDate
(5) fileSearch FindFirst findNext findClose fileExists
(6) copyFile MoveFile Rename RenameFile ChangeFileExt DeleteFile Erase Truncate
(7) AddignFile Reset ReWrite Append CloseFile FileOpen fileCreate fileClose
(8) Seek filePos Eof Eoln FileSeek SeekEoln
(9) Read ReadLn Write writeln FileRead fileWrite BlockRead BlockWrite
Flush(F)
更多精彩
赞助商链接