multidiskscanner Example of changing the search rules at run-time
dcMultiDiskScanner component TDiskScanList class Search rules designers
Return to Introduction  Previous page  Next page
Following examples demonstrates how to change the IncludeList and ExcludeList searching rules at run-time of your application.


Example
Let's say, we would like to find all picture files (BMP, JPG, JPEG and GIF) at location specified by PictureFolder variable, but would like to exclude all files that begins by "a" letter from search results. We don't want to search the files in subfolders under PictureFolder directory.  
 
with dcMultiDiskScanner do  
 begin  
  with IncludeList do  
   begin  
    Clear; // clear the IncludeList  
    AddPath(PicturesFolder + '\*.bmp', False); // False - don't include subfolders  
    AddPath(PicturesFolder + '\*.jpg', False);  
    AddPath(PicturesFolder + '\*.jpeg', False);  
    AddPath(PicturesFolder + '\*.gif', False);  
   end;  
 
  with ExcludeList do  
   begin  
    Clear; // clear the ExcludeList  
    AddPath('a*.*', False);  
//or...  
//  AddPath(PicturesFolder + '\a*.*', False);  
   end;  
  Execute;  
 end;  


See also
dcMultiDiskScanner component, TDiskScanList and TDiskScannerPath classes.