文件与目录

2016-02-19 13:22 3 1 收藏

下面请跟着图老师小编一起来了解下文件与目录,精心挑选的内容希望大家喜欢,不要忘记点个赞哦!

【 tulaoshi.com - 编程语言 】

  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;

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

  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)    

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/bianchengyuyan/)

来源:https://www.tulaoshi.com/n/20160219/1603983.html

延伸阅读
 Public Sub CopyDerictory(ByVal DirectorySrc As DirectoryInfo, ByVal DirectoryDes As DirectoryInfo)         Dim strDirectoryDesPath As String = DirectoryDes.FullName & "\" & DirectorySrc.Name              If Not Dir...
在用 CHKDS/V 对磁盘子目录及子目录文件进行查找时,由于输出显示信息没有分屏显示,很轻易错过需要的信息,并且显示信息没有标记出隐藏的子目录名及子目录文件名,这样就 对进一步的子目录及文件操作带来许多不便。若辅以管道操作采用CHKDSK/V:MORE,虽然可 分屏显示,但等待输出时间过长,而且这时 ^_Break 中断被封锁,效果不尽人意。...
(1)查找指定扩展名的文件 procedure TForm1.Button1Click(Sender: TObject); var   sr: TSearchRec; begin   ListBox1.Items.Clear ;   if FindFirst('D:work*.*', faAnyFile, sr) = 0 then   begin     repeat       if pos('...
标签: ASP
  Many times we might need some part of code which will access all sub-folders of the server and also all      files within the sub-folder.      The following line of asp code will map to a specified folder and searches all the sub-folders    &nbs...
标签: ASP
      '**************************************     ' Name: File / Directory Viewer     ' Description:This Will Display All The     '     Files, File Size and file date of every     ' ...

经验教程

622

收藏

55
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部