相关疑难解决方法(0)

如何使用FindFirst搜索不同的文件类型?

在我的应用程序中,我使用以下过程递归扫描任何文件夹和子文件夹,如果文件夹包含文本文件(*.txt)我将文件名添加到我的过程中定义的TStringList:

procedure FileSearch(const PathName: string; var lstFiles: TStringList);
const
  FileMask = '*.txt';
var
  Rec: TSearchRec;
  Path: string;
begin
  Path := IncludeTrailingBackslash(PathName);
  if FindFirst(Path + FileMask, faAnyFile - faDirectory, Rec) = 0 then
    try
      repeat
        lstFiles.Add(Path + Rec.Name);
      until FindNext(Rec) <> 0;
    finally
      FindClose(Rec);
    end;

  if FindFirst(Path + '*.*', faDirectory, Rec) = 0 then
    try
      repeat
        if ((Rec.Attr and faDirectory) <> 0) and (Rec.Name <> '.') and
          (Rec.Name <> '..') then
          FileSearch(Path + Rec.Name, lstFiles);
      until FindNext(Rec) <> 0;
    finally
      FindClose(Rec); …
Run Code Online (Sandbox Code Playgroud)

delphi wildcard

12
推荐指数
1
解决办法
1万
查看次数

Inno Setup:在Code部分中递归复制文件夹,子文件夹和文件

有没有办法在代码部分中浏览和递归复制/移动目录的所有文件和子目录?(PrepareToInstall)

我需要忽略一个特定的目录,但是使用xcopy它会忽略所有目录/default/,例如,我只需要忽略一个特定的目录.

Files部分在需要时稍后执行.

inno-setup pascalscript

6
推荐指数
1
解决办法
6470
查看次数

标签 统计

delphi ×1

inno-setup ×1

pascalscript ×1

wildcard ×1