Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Searching in disk
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01417400
Message ID:
01417422
Vues:
59
Corrected version of GetAllFiles1
********************************************************************************
*  Description.......: GetAllFiles1 - builds list of all files in directory tree
*                    : uses Adir recursive call
*  Calling Samples...: =GetAllFiles1("C:\Documents and Settings\",'zip')
*  Parameter List....: tcStartDir, tcFileExt
*  Created by........: David Frankenbach
*  Modified by.......: 
********************************************************************************
* ADIR() method of recursively building the file list - Dave Frankenbach
lparameters tcStartDir, tcFileExt
* tcStartDir - top directory to start from
* tcFileExt - only files with this extension would be added to the list,
*             leave blank for all file extensions

* Both parameters should be character type, check it first
**************************************************************************
if empty(tcStartDir) or vartype(tcStartDir)<>'C'
	tcStartDir='c:\' && Get list of files in the whole local drive
else
	tcStartDir=addbs(tcStartDir)
endif
if empty(tcFileExt) or vartype(tcFileExt)<>'C'
	tcFileExt='' 
endif

local ltStart
ltStart = datetime()
local lnTotNumberOfFiles
* 254 may not be enough, we can use Memo instead
create cursor curFilesADIR (cFilename c(254), nSize n(10), dMod d)
=RecurseFolder(tcStartDir, tcFileExt) && Call recursive procedure
lnTotNumberOfFiles=reccount('curFilesAdir')
? datetime() - ltStart, lnTotNumberOfFiles

*index on upper(justfname(cFileName)) tag cFileName
browse nowait
*------------------------------------------------------------------------
function RecurseFolder
lparameters lcDir, lcFileExt
local i , n, laFiles[1]

n = adir(laFiles, lcDir + '*.*', "shd" )

for i = 1 to n
	if (left(laFiles[i,1], 1) != '.' )
		if ("D" $ laFiles[i,5] )
			RecurseFolder(lcDir + laFiles[i,1] + "\", m.lcFileExt )
		else
			if empty(lcFileExt) or UPPER(justext(laFiles[i,1]))== UPPER(m.lcFileExt)                    
					insert into curFilesADIR ;
					values( lcDir + laFiles[i,1], laFiles[i,2], laFiles[i,3] )
			endif
		endif
	endif
endfor
return
>I found the program below in your link
>
>But I does not execute form my form button
>
>I supposed I could execute it using pcStartDir and pcFileExt as textobox of my form
>
>Any idea ?
>
>Moises
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform