各位兄弟姐妹来帮帮忙:怎么实现批量添加文件夹下的文件路径到ACCESS数据库表中
比如:文件夹‘电影’下有20个视频文件,怎么样可以批处理一次性添加这20个文件的文件名和其物理路径到数据库中

解决方案 »

  1.   

    procedure findall(diskpath: String; var fileresult: TStringList);
    var
    fpath: String;
    fs: TsearchRec;
    begin
    fpath:=diskpath+'\*.*';
    if FindFirst(fpath,faAnyFile,fs)=0 then
       begin
       if (fs.Name<>'.')and(fs.Name<>'..') then
         if (fs.Attr and faDirectory)=faDirectory then
             findall(diskpath+fs.Name,fileresult)
           else         fileresult.add(diskpath+fs.Name+'('+inttostr(fs.Size)+')');
         while findnext(fs)=0 do
           begin
           if (fs.Name<>'.')and(fs.Name<>'..') then
             if (fs.Attr and faDirectory)=faDirectory then
                 Findall(diskpath+fs.Name,fileresult)
             else begin             fileresult.add(diskpath+fs.Name);
             end;
           end;
       end;
    Findclose(fs);
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    var
      str:TStringList;
      i:Integer;
    begin
      str:=TStringList.Create;
      findall(ExtractFilePath(Application.ExeName),str);
      for i:=0 to str.Count-1 do
      begin
        do Insert
      end;end;
      

  2.   

    路过,支持 kernelj 孖八 兄的回答,准确而且通用性良好。