- 8
- 0
- 约1.13万字
- 约 19页
- 2017-06-10 发布于河南
- 举报
Delphi文件、文件夹常用操作(国外英文资料)
Delphi文件、文件夹常用操作(国外英文资料)
RemoveDirectory
/ / get the current folder, GetCurrentDir
/ / set the current folder, SetCurrentDir. ChDir; SetCurrentDirectory
/ / get the current path name GetDir for the specified driver
/ / file name RenameFile
/ / create the folder CreateDir; CreateDirectory; ForceDirectories
/ / remove empty folder RemoveDir; RemoveDirectory
/ / create a new file FileCreate
/ / get the version number of the current file, GetFileVersion
/ / get the disk space DiskSize; DiskFree
/ / FindFirst; FindNext; FindClose
/ / read and set the file properties FileGetAttr; FileSetAttr
/ / the creation time of the file to be FileAge; FileDateToDateTime
Delphi code
/ / determine if the file exists
var
F: string;
The begin
F: = c: \ temp \ test.txt;
Then if not FileExists (f)
The begin
/ / if the file doesnt exist
The end;
The end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
/ / determine if DirectoryExists is in the folder
var
Dir: string;
The begin
Dir: = c: \ temp;
If not DirectoryExists (dir) then
The begin
/ / if the folder doesnt exist
The end;
The end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
/ / delete file DeleteFile; / / delete file DeleteFile Windows. The DeleteFile
var
F: string;
The begin
F: = c: \ temp \ test.txt;
/ / DeleteFile (f); / / return a Boolean
/ or use the system API:
Windows. DeleteFile (PChar (f)); / / return a Boolean
The end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
原创力文档

文档评论(0)