Jump to content

vider le dossier temporaire


Recommended Posts

enregistrer ce script avec l'extension .vbs et double cliquer quant vous désirer supprimer tout les fichiers dans le dossier temporaire .

 

Dim fso
Dim DelCount
Dim FileCount

Sub DelDirs(ADir)
Dim folders, files
Dim folder, file
 Set folders = fso.getfolder(ADir)
 Set files = folders.files
 
 For Each folder In folders.subfolders
    DelDirs folder.Path
    On Error Resume Next
    folder.Delete
 Next
 
 For Each file In files
   FileCount = FileCount + 1
   On Error Resume Next
   file.Delete True
   If Err.Number = 0 Then
     DelCount = DelCount + 1
   End If
   Err.Clear
   On Error GoTo 0
 Next
End Sub

if MsgBox("voulez-vous vraiment vider le dossier temporaire ?", &H34)= 6 then
  Set fso = CreateObject("scripting.filesystemobject")
  FileCount = 0
  DelCount  = 0
  DelDirs fso.GetSpecialFolder(2)
  MsgBox "fichiers supprimés : " & vbcr & DelCount & "  sur " & FileCount
End If




Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Répondre

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...