' Thierry DEMAN 'on error resume next ' ************** Initialisation des objets ***** Dim objFS, WshShell,WshNetwork SET wshshell = createObject ("Wscript.shell") SET wshnetwork = Wscript.createObject ("Wscript.Network") SET objFS=CreateObject ("Scripting.FileSystemObject") ' server = Wshshell.ExpandEnvironmentStrings("%COMPUTERNAME%") ' *************** initialiation des variables ***** DIM Nb, I ' Set up global data. TabStop = Chr(9) NewLine = Chr(13) Nb=0 Dim Fic(),Chem() TD=now() wscript.echo "Current Time :"+Cstr(TD) TD=DateAdd("d", -7, TD) wscript.echo "Remove before :"+Cstr(TD) ' *************** Debut du programme principal ***** wscript.echo "Recherche en cours" SET oFolder = objFS.getFolder(".") vExtension="remove" SearchFolder(oFolder) Wscript.QUIT '**************** Fin du Programme principal ***** '******************* Debut des fonctions ***** Function SearchFolder(Folder) Dim SubFolders, Files, oFile 'objets Dim Fichier 'Wscript.echo "Folder:" & TabStop & Folder.Path Set Files = Folder.Files If Files.Count <> 0 Then For Each oFile in Folder.Files ' wscript.echo(objFS.GetExtensionName(oFile.Name)) if lcase(objFS.GetExtensionName(oFile.Name)) = vExtension then wscript.echo oFile.name+" "+ofile.path+" "+CStr( ofile.DateLastModified) IF Ofile.DateLastModified<=TD Then ofile.delete End If Next End If Set SubFolders = Folder.SubFolders If SubFolders.Count <> 0 Then For Each SubFolder In SubFolders if lcase(objFS.GetExtensionName(subfolder.Name)) = vExtension then wscript.echo SubFolder.name+" "+SubFolder.path+" "+ Cstr(SubFolder.DateLastModified) IF SubFolder.DateLastModified<=TD Then SubFolder.delete else SearchFolder(SubFolder) End If Next End If End Function ' ******* Fin des modules *********************