PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Method 1: Retrieving the list of files directly
  • Method 2: Using a "Callback" procedure to process each file independently
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
To browse the files found in a directory, you must use fListFile. This function is used to:
  • list all the files found in a directory and in its sub-directories.
  • list the files found in a directory without going into the sub-directories.
  • list the files with a filter (extension and/or name).
Two methods are available:
Method 1: Retrieving the list of files directly
To directly retrieve the list of files:
  1. Retrieve in a character string the list of all files by using fListFile.
  2. Browse the retrieved string in a loop. Each file is separated by a CR character.
  3. Process each file found.
Code sample:
sFileList is string
sFile is string

sFileList = fListFile("C:\TEMP\*.DOC")

FOR EACH STRING sFile OF sFileList SEPARATED BY CR
// Process the sFile file
// the sFile variable contains the name of the file to process

END
Method 2: Using a "Callback" procedure to process each file independently
To process each listed file independently via a WLanguage procedure:
  1. Create a local or internal procedure to process each file found.
  2. Browse the list of all files by using fListFile associated with the procedure that was created beforehand.
Code sample:
INTERNAL PROCEDURE pProcessFile(sDir, sFile)
// Process the file found
// The sDir variable contains the file directory
// The sFile variable contains the name of the file
Trace(sDir, sFile)
END

fListFile("C:\TEMP\*.DOC", pProcessFile)
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment