File search in turbo pascal? 
Author Message
 File search in turbo pascal?

i'm using turbo Pascal 7.0 & i am having trouble using the FSearch command...i
can't seem to find the file i want to find...unless i'm already in that
directory...is there any way i can use it to search the entire drive for a
filename,or even multiple drives...or is there another command for it?
thanx!

ciao!



Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?

Quote:
> i'm using turbo pascal 7.0 & i am having trouble using the FSearch command...i
> can't seem to find the file i want to find...unless i'm already in that
> directory...is there any way i can use it to search the entire drive for a
> filename,or even multiple drives...or is there another command for it?

   FSearch isn't what you want - try FindFirst/FindNext.  FSearch
searches only the DOS path.


Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?


Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?

Quote:

>i'm using turbo pascal 7.0 & i am having trouble using the FSearch command...i
>can't seem to find the file i want to find...unless i'm already in that
>directory...is there any way i can use it to search the entire drive for a
>filename,or even multiple drives...or is there another command for it?
>thanx!

To do a disksearch you should use something like this attachment...
Groetjes, willem.....


Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?


Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?

begin 644 filefind.pas
<uuencoded_portion_removed>

`
end



Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?


Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?

Quote:

>i'm using turbo pascal 7.0 & i am having trouble using the FSearch command...i
>can't seem to find the file i want to find...unless i'm already in that
>directory...is there any way i can use it to search the entire drive for a
>filename,or even multiple drives...or is there another command for it?
>thanx!

To do a disksearch you should use something like this <SOURCE>...
(attachment is not a very good idea...)
Groetjes, willem.....

PROGRAM EvenKijkenOfDatLukt;
USES Crt,Dos;

VAR FileFound:BOOLEAN;
    x,y:INTEGER;

FUNCTION Exists(FileName: string): Boolean;
   VAR AnyInfo:SEARCHREC;
   BEGIN
      FindFirst(FileName, AnyFile, AnyInfo);
      IF DosError = 0 THEN Exists:=TRUE
      ELSE Exists:=FALSE
   END;

PROCEDURE FindFile(Name:STRING);
   VAR FileInfo:SearchRec;
   BEGIN
      FindFirst(Name,Archive,FileInfo);
      IF DosError=0 THEN FileFound:=TRUE
      ELSE FileFound:=FALSE
   END;

PROCEDURE ScanDisk(Drive,FileName:STRING);
   VAR DirInfo:SearchRec;
       s:STRING;
   BEGIN
      GotoXY(x,y);
      WRITE('Searching in ',Drive,' for ',FileName);
      ClrEol;
      FindFile(FileName);
      IF FileFound THEN Exit;
      FindFirst('*.*',Directory,DirInfo);
      WHILE DosError=0 DO BEGIN
         IF (DirInfo.Name<>'.') AND (DirInfo.Name<>'..') THEN BEGIN
            GetDir(0,s);
            {$I-}
            ChDir(DirInfo.Name);
            {$I+}
            IF IoResult=0 THEN BEGIN
               ScanDisk(DirInfo.Name,FileName);
               IF FileFound THEN Exit
            END
         END;
         FindNext(DirInfo)
      END;
      {$I-}
      ChDir('..');
      {$I+}
      IF IoResult<>0 THEN WRITE(' ? ')
   END;

VAR
   DirNow,DriveName,FileName:STRING;

BEGIN
   ClrScr;
   GetDir(0,DirNow);
   TextColor(Yellow);
   WriteLn('FileSearch v0.1     SkyLine SoftWare, Nijmegen');
   DriveName:='';
   FileName:='';
   IF ParamCount<>0 THEN BEGIN
        IF POS(':',ParamStr(1))<>0 THEN DriveName:=ParamStr(1)
      ELSE IF POS(':',ParamStr(2))<>0 THEN DriveName:=ParamStr(2)
      ELSE DriveName:='';
      IF POS('.',ParamStr(1))<>0 THEN FileName:=ParamStr(1)
      ELSE IF POS('.',ParamStr(2))<>0 THEN FileName:=ParamStr(2)
      ELSE FileName:=''
   END;
   TextColor(LightGray);
   WriteLn;
   Write('Give drive    : ');
   TextColor(Green);
        IF DriveName='' THEN ReadLn(DriveName)
   ELSE WriteLn(DriveName);
   TextColor(LightGray);
        IF DriveName='' THEN EXIT;
   Write('Give filename : ');
   TextColor(Green);
        IF FileName='' THEN ReadLn(FileName)
   ELSE WriteLn(FileName);
   IF FileName='' THEN EXIT;
   {$I-}
   TextColor(Magenta);
        WriteLn;
        IF POS('\',DriveName)=0 THEN ChDir(DriveName+'\')
   ELSE ChDir(DriveName);
   {$I+}
   IF IoResult<>0 THEN BEGIN
      WriteLn('Can''t find ',DriveName);
      Exit
   END;
   x:=WhereX;
   y:=WhereY;
   ScanDisk(DriveName,FileName);
   GotoXY(x,y);
   ClrEol;
   TextColor(LightRed);
   IF FileFound THEN BEGIN
      GetDir(0,DriveName);
      WriteLn(FileName,' found in ',DriveName)
   END
   ELSE WriteLn(FileName,' not found on ',DriveName);
   WriteLn;
   TextColor(Yellow);
   Write('Type ENTER to exit...');
   TextColor(LightGray);
   ChDir(DirNow);
   ReadLn
END.



Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?


Wed, 18 Jun 1902 08:00:00 GMT  
 File search in turbo pascal?

Quote:

>begin 644 filefind.pas
>M4%)/1U)!32!%=F5N2VEJ:V5N3V9$871,=6MT.PT*55-%4R!#<G0L1&]S.PT*


















































>`
>end

I can't read your code.  Can you translate into english please?

John



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. File search in turbo

2. I NEED TURBO PASCAL 7.0 HELP FILE (TURBO.TPH)

3. Index-file browser for turbo vision (Turbo Pascal ver 6.0)

4. Searching for old Turbo PASCAL 3 Compiler

5. X-Finder, the Turbo Pascal search-engine

6. Need : Recursive file search/directory search

7. Urgent -- Saving a Turbo Pascal file into .tXt file

8. Pascal-search the web quickly with Search Spaniel

9. Pascal-search the web quickly with Search Spaniel

10. Turbo Pascal 7 or Educational Turbo Pascal 7

11. Converting Image Files (BMP?) To Turbo Pascal Arrays

12. Help decompiling turbo pascal exe file

 

 
Powered by phpBB® Forum Software