Lister fichiers dans sous repertoires
Bonjour,
j'ai une petite fonction qui leste des fichiers en date de création donnée dans un répertoire.
mais je ne parviens pas à réaliser la même opération dans les sous répertoires
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
Option Explicit
Dim oFSO, oFolder, sDirectoryPath, odirectory, subDirectory, explDirectory
Dim oFileCollection, oFile
Dim iDaysOld
Dim file, Datecreated
sDirectoryPath = "D:\"
iDaysOld = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.Files
'***************************************debut su Scan************************************************
If ofso.FolderExists(sDirectoryPath) Then
Set odirectory = oFso.GetFolder(sDirectoryPath)
Set oFileCollection=odirectory.Files
For each oFile in oFileCollection
set file = oFSO.GetFile(oFile)
Datecreated = file.Datecreated
If file.Datecreated > (Date()- iDaysOld)Then
WScript.Echo file.Datecreated
WScript.Echo file.Name
WScript.Echo file.Path
End If
Next
'Set subDirectory = odirectory.SubFolders
'For Each explDirectory In subDirectory
'WScript.Echo explDirectory.Path
'Next
End If |
comment réaliser la meme opération dans les sous repertoires.
Merci de votre aide