on error resume next
Set Shell = CreateObject("WScript.Shell" )
Temp = Shell.Environment("Process" )("TEMP" ) & "\"
CleanDir Temp
Tmp = Shell.Environment("Process" )("TMP" ) & "\"
CleanDir Tmp
Set Shell = Nothing
sub CleanDir(Path)
On error resume next
Dim Folder, FSO, SubFolder, File
Set FSO = Wscript.CreateObject("Scripting.FileSystemObject" )
Set Folder = FSO.GetFolder(Path)
for each SubFolder in Folder.SubFolders SubFolder.Delete True ' Force la suppression du dossier
next
for each File in Folder.Files
File.Delete True ' Force la suppression du fichier
next
Set Folder = Nothing
Set FSO = Nothing
end sub |