Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 17-06-2005
spab spab is offline
Registrado
 
Registrado: jun 2005
Posts: 7
Poder: 0
spab Va por buen camino
problema con aplicación para consola


Tengo el siguiente problema, estoy intentando hacer con delphi un ejecutable para pasarle parámetros desde la consola; pero me dice que una de las funciones que utilizo esta redeclarada. ¿Alguien me puede ayudar?





program Limpieza;

{$APPTYPE CONSOLE}

uses
SysUtils, Messages, Variants, Classes, Controls,
Dialogs, StdCtrls;
function FindFile(const filespec: TFileName; attributes: integer = faReadOnly Or faHidden Or faSysFile Or faArchive): TStringList;

var lista: TStringList;

begin
{ TODO -oUser -cConsole Main : Insert code here }

lista := FindFile('c:\borrame\')//ParamStr(1)+'*.*');
if lista.Count=0 then ShowMessage('¡No existen ficheros!');

end;


function FindFile(const filespec: TFileName; attributes: integer): TStringList;
var
spec: string;
list: TStringList;

procedure RFindFile(const folder: TFileName);
var lista: TStringList;
SearchRec: TSearchRec;
begin
// Busca todos los archivos concordantes
// en la carpeta actual y agrega sus nombres
// a la lista
if FindFirst(folder + spec, attributes,
SearchRec) = 0 then begin
try
repeat
if (SearchRec.Attr and faDirectory = 0)
or (SearchRec.Name <> '.')
and (SearchRec.Name <> '..') then
list.Add(folder + SearchRec.Name);
if FileDateToDateTime(SearchRec.time) < (Now-3) then
DeleteFile(folder + SearchRec.Name);
until FindNext(SearchRec) <> 0;
except
FindClose(SearchRec);
raise;
end;
FindClose(SearchRec);
end;
// Ahora busca en las subcarpetas
if FindFirst(folder + '*', attributes
Or faDirectory, SearchRec) = 0 then begin
try
repeat
if ((SearchRec.Attr and faDirectory) <> 0) and
(SearchRec.Name <> '.') and(SearchRec.Name <> '..') then
RFindFile(folder + SearchRec.Name + '\');
until FindNext(SearchRec) <> 0;
except
FindClose(SearchRec);
raise;
end;
FindClose(SearchRec);
end;
end; // procedure RFindFile dentro de FindFile

begin // function FindFile
list := TStringList.Create;
try
spec := ExtractFileName(filespec);
RFindFile(ExtractFilePath(filespec));
Result := list;
except
list.Free;
raise;
end;
end;

end.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 17:48:13.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi