AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • Finding out the number of read-only ".TXT" files
  • Finding out the number of read-only "*.DOC" files
fListFile (Example)
Finding out the number of read-only ".TXT" files
WINDEVReportes y ConsultasJavaCódigo de Usuario (UMC)
The following code is used to find out the number of read-only ".TXT" files found in a directory selected by the user. The directory is selected by fSelectDir.
// Declare and initialize the variables
 
// Number of files matching the criteria
NbROFiles is int
// Number of "*.TXT" files
NbTXTFiles is int  
NbTXTFiles = 0
SearchCriterion is string
 
// Select the directory in which the files will be listed
SearchCriterion = fSelectDir("", "Select a directory", ...
"Finding the .TXT files in the selected directory")
 
// Add the "\*.TXT" criterion at the end of the name of the selected directory
SearchCriterion = SearchCriterion + "\*.TXT"
 
// List the "*.TXT" files
NbTXTFiles = fListFile(SearchCriterion, "FileAttribute", &NbROFiles)
 
// Display the number of files matching the criteria
Info("There are " + NbROFiles + " read-only files out of " + ...
NbTXTFiles + " listed files")
// Local fListFile procedure
PROCEDURE FileAttribute(Directory, Name, Change, NbTXTFiles)
// Declare the variable
NbROFiles is int
// Read-only files?
IF Position(fAttribute(Directory + Name), "R") <> 0 THEN
  Transfer(&NbROFiles, NbTXTFiles, 4)
  NbROFiles++
  Transfer(NbTXTFiles, &NbROFiles, 4)
  // Display the name of the file in "LIST_FileList"
  ListAdd(LIST_FileList, Directory + Name)
END
RETURN True
Finding out the number of read-only "*.DOC" files
WEBDEV - Código ServidorPHPAjax
The following code is used to find out the number of read-only "*.DOC" files found in a directory selected by the user.
// Declare and initialize the variables
 
// Number of files matching the criteria
NbROFiles is int
// Number of "*.DOC" files
NbDocFiles is int
NbDocFiles = 0
SearchCriterion is string
 
// Select the directory in which the files will be listed
SearchCriterion = "C:\MyDocuments\"
 
// Add the "\*.doc" criterion at the end of the name of the selected directory
SearchCriterion = SearchCriterion + "\*.doc"
 
// List of "*.DOC" files
NbDocFiles = fListFile(SearchCriterion, "FileAttribute", &NbROFiles)
 
// Display the number of files matching the criteria
Info("There are" + NbROFiles + "read-only files out of" + ...
NbTXTFiles + "listed files")
 
// Local fListFile procedure
PROCEDURE FileAttribute(Directory, Name, Change, NbDocFiles)
// Declare the variable
NbROFiles is int
// Read-only files?
IF Position(fAttribute(Directory + Name), "R") <> 0 THEN
Transfer(&NbROFiles, NbDocFiles, 4)
NbROFiles++
Transfer(NbDocFiles, &NbROFiles, 4)
// Display the name of the file in "LIST_FileList"
ListAdd(LIST_FileList, Directory + Name)
END
RETURN True
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 22/08/2022

Señalar un error o enviar una sugerencia | Ayuda local