ReadDir
ReadDir DirName$, Filter$, RecursiveFlag, SortFlag
 
Parameters:

    DirName$ =The Directory you wish to locate the files/folders within
    Filter$ = The filename filter for performing custom directory scanning
    RecursiveFlag = A flag to toggle recursive suib-directory scanning
    SortFlag = A flag to toggle sorting of the files/folders
Returns: NONE
 

      ReadDir is a powerful command for the collecting of files/folders within a directory. The scanning can also be customized to filter out user defined file types & file names and can automatically recursively locate and sort files within the select directory.

      The Files & Folder names located by ReadDir are stored within an internal array. You can query the list using the GetDirSize, GetDir$, GetDirFile$, GetDirFolder$ commands



FACTS:


      * Recursively finding all the files in a path can be very slow ! In particular, when trying to locate all the files in on a hard drive for example. If that's what you want, then we strongly recommend using a different approach, as your application will dead while it's off brute force scanning the device. (See FirstFile$)




Usage Example:


      This example simply lists the files and folders on your the C: drive.

  
  ThisDir$="C:\"
  
  // Check this location exists
  If FolderExist(ThisDir$)
     
     // Read all the files and sort them
     ReadDir ThisDIr$,"",0,1
     
     // display the results
     For Files=0 To GetDirSize()-1
        If GetDirFileType(files)=1
           Print GetDirFile$(files)
        EndIf
     Next
     
  EndIf
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  





 
Related Info: GetDir$ | GetDirFile$ | GetDirFileType | GetDirFolder$ | GetDirSIze :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com