Jump to content

Recommended Posts

Posted

Podes fazer isso contando os ficheiros e/ou o seu tamanho total e depois, quando copias, vais progredindo de acordo com o número de ficheiros ou KBs copiados (depende de como faças a cópia).

Pesquisa na API do Windows, é capaz de haver algo por lá que te dê o número de ficheiros e/ou o tamanho do que queres copiar recursivamente.

10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Posted (edited)

Podes usar esta função que fiz para devolver um TStringlist com a lista de ficheiros dentro de uma pasta

 

function ListFileDir(Path,Ext: string;OnlyTopFolder:boolean; var FileList: TStringList):boolean;
var
  SR: TSearchRec;
begin
  result:=false;
  if DirectoryExists(path) then
  Begin
    result:=true;
    if FindFirst(Path + '*'+Ext, faAnyFile, SR) = 0 then
    begin
      repeat
        FileList.Add(Path+SR.Name);
      until FindNext(SR) <> 0;
      FindClose(SR);
    end;

    if not OnlyTopFolder then
      if FindFirst(Path+'*' , faDirectory, SR) = 0 then
      begin
        repeat
          if (SR.Name<>'..') and (SR.Name<>'.') then
            ListFileDir(Path+SR.Name+'\',ext,OnlyTopFolder,FileList);
        until FindNext(SR) <> 0;
        FindClose(SR);
      end;
  end;
end;

 

Basicamente passas o caminho e extensão de ficheiros que queres e passas uma TStringList por referência.

Depois é uma questão de correres a TStringList a copiar os ficheiros e a mostrar numa TProgressBar

Edited by Kline777

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.