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:
01417418
Vues:
55
Here is the fixed version of this program
********************************************************************
* Description.......: GetAllFiles - builds a list of all files in start directory and subdirectories
* Calling Samples...: ?GetAllFiles('\Redp\Appl','SCX')
* Parameter List....: pcStartDir, pcFileExt
* Created by........: Ed Rauh
* Modified by.......: Nadya Nosonovsky 10/18/2000 11:18:39 AM
********************************************************************
* Scripting.FileSystemObject example of recursive file list build - Ed Rauh
LPARAMETERS pcStartDir, pcFileExt
* pcStartDir - top directory to start from
* pcFileExt - only files with this extension would be added to the list,
* leave blank for all file extensions

IF EMPTY(pcStartDir)
	pcStartDir='c:\' && Get list of files in the whole local drive
ENDIF

LOCAL ltStartFSO
ltStartFSO = DATETIME()
PRIVATE pnTotNumberOfFiles
pnTotNumberOfFiles=0
CREATE CURSOR filesFSO ( cFilename c(100), nSize N(10), dMod d )
oFSO = CREATEOBJECT('Scripting.FileSystemObject')

=RecurseFolderFSO(oFSO.GetFolder(pcStartDir), pcFileExt)
? DATETIME() - ltStartFSO, pnTotNumberOfFiles

INDEX ON nSize TAG nSize
BROWSE
****************************************************
FUNCTION RecurseFolderFSO
LPARAMETER toFolderObject, pcFileExt
WITH toFolderObject
	FOR EACH oFile IN .FILES
		WITH oFile
			IF EMPTY(pcFileExt) OR JUSTEXT(.PATH)==pcFileExt
				INSERT INTO filesFSO ;
					VALUES (.PATH, .SIZE, .DateLastModified )
				pnTotNumberOfFiles=pnTotNumberOfFiles+1
			ENDIF
		ENDWITH
	ENDFOR
	FOR EACH oSubFolder IN .SubFolders
		RecurseFolderFSO(oSubFolder)
	ENDFOR
ENDWITH
toFolderObject = NULL
RETURN
However, it's much better to use ADIR() instead (check the other function in that message).

Also, in my case it gave me an error (probably because I have some hidden directories)



>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