ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Finding out the number of hidden directories
fListDirectory (Example)
Finding out the number of hidden directories
The following code is used to return the number of hidden directories found in a directory selected by the user. The directory is selected by fSelectDir.
// Declare and initialize the variables

// Number of directories matching the criteria
NbDirectoryLS is int  
NbDirectory is int = 0
SearchCriterion is string
// Select the directory in which the directories will be listed
SearchCriterion = fSelectDir("", "Select a directory", ...
		"Searching for hidden directories")
// List of directories
NbDirectoryLS = fListDirectory("C:\MyDocuments", "DirectoryAttribute", ...
		&NbDirectoryLS)
// Display the number of files matching the criteria
Info("There are " + NbDirectoryLS + " hidden directories on " + ...
		NbDirectory + " listed directories")
// --------------------------------------------------------
// Local procedure called by fListDirectory
PROCEDURE DirectoryAttribute(Directory, Name, Change, NbDirectory)
// Declare the variable
NbDirectoryLS is int
// Hidden directory?
IF Position(fAttribute(Directory + Name), "H") <> 0 THEN
	Transfer(&NbDirectoryLS, NbDirectory, 4)
   	NbDirectoryLS ++
   	Transfer(NbDirectory, &NbDirectoryLS, 4)
   	// Display the name of the directory in the "LIST_FileList" list
   	ListAdd(LIST_FileList, Directory + Name)
END
RETURN True
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help