home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / PDIR10.ZIP / PFF.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1989-08-18  |  1.2 KB  |  66 lines

  1. program PDTest;
  2.  
  3. uses Objects,PDir,Dos;
  4.  
  5. var
  6.   DP: DirEntryPtr;
  7.   St: DirStream;
  8.   Orig: PathStr;
  9.  
  10. procedure ProcessDir(D: DirEntryPtr; DirName: PathStr);
  11.   var
  12.     DirPtr : DirEntryPtr;
  13.   begin
  14.   DirPtr := DirEntryPtr(D^.DirEntries.First);
  15.   while DirPtr <> nil do
  16.     begin
  17.     if DirPtr^.IsDirectory then
  18.       ProcessDir(DirPtr,DirName+'\'+DirPtr^.FileName)
  19.       {recursively process subdirectories}
  20.     else
  21.       WriteLn(DirName+'\'+DirPtr^.FileName);
  22.     DirPtr := DirEntryPtr(D^.DirEntries.Next(DirPtr));
  23.     end;
  24.   end;
  25.  
  26.  
  27.  
  28. begin
  29. Orig := CurDir;
  30. WriteLn('Palcic''s File Finder v1.0');
  31.  
  32. if ParamCount = 0 then { Syntax is incorrect }
  33.   begin
  34.   WriteLn;
  35.   WriteLn('Syntax: PFF filespec');
  36.   WriteLn;
  37.   WriteLn('Directory names can not be passed.');
  38.   WriteLn;
  39.   WriteLn('Example: PFF *.ZIP');
  40.   WriteLn;
  41.   Halt;
  42.   end;
  43.  
  44. ChDir('C:\');
  45. New(DP,Clear);
  46.  
  47. WriteLn;
  48. Write('Scanning for ',ParamStr(1),'...');
  49. DP^.FindDirectories(ParamStr(1),Archive);
  50. WriteLn;
  51. WriteLn;
  52.  
  53. ProcessDir(DP,'C:');
  54.  
  55. WriteLn;
  56. WriteLn('Back to original directory ',Orig);
  57. ChDir(Orig);
  58.  
  59. St.Init('PFF.DAT',SCreate);
  60. DP^.Store(St);
  61. St.Done;
  62.  
  63. Dispose(DP,Done);
  64.  
  65. end.
  66.