Bonjour à tous,

je souhaiterais supprimer tous les fichiers.log de mon dossier "Test"

Lorsque j’exécute le script: Il zip bien, déplace bien le .zip, mais ne supprime pas les fichiers.log dans le dossier d'origine

Merci à tous pour votre aide.

PAB/31/SAB


Mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Dim Centre
Dim ListeCentre
Dim Plaque
Dim REP_SOURCE 
Dim REP_DESTINATION	
DIM LOG
 
Dim objFSO, objFolder, FileLog,fso,fileflag
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objArgs = Wscript.Arguments 
 
VERSION="1.00"
 
 
centre = objArgs(0) 
 
Select Case Centre
Case "AB"
	Plaque="OR"
Case "CD"
	Plaque="OR"
Case "EF"
	Plaque="ARGENT"
Case "GH"
	Plaque="ARGENT"
Case "IJ"
	Plaque="ARGENT"
Case Else
	Wscript.echo "Erreur dans le parametre"
	wscript.quit(2)
End Select
 
 
 
LOG="E:\Appli\projets\Log\sauv_mens_" & centre & ".log"
 
 
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set FileLog = FSO.CreateTextFile(Log)
 
MyDate = Day(Now) & "." & Month(Now) & "." & Year(Now)
 
 
 
 
'Debut du traitement
'For Each Centre In Split(ListeCentre,";",-1)
For Each Centre In Split(Centre,";",-1)
 
 
	Source = "E:\Appli\projets_" & plaque & "\ " & Centre & "\TEST"
 
	Destination = "H:\Historique\" & Centre & "\TEST\test_sauv_" & Centre & " " & MyDate & ".zip"
 
 
MyHex = _
Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
For i = 0 To UBound(MyHex)
    MyBinary = MyBinary & Chr(MyHex(i))
Next
 
Set oShell = CreateObject("WScript.Shell")
Set oFileSys = CreateObject("Scripting.FileSystemObject")
 
'Creation du zip
set oCTF = oFileSys.CreateTextFile(Destination, True)
oCTF.Write MyBinary
oCTF.Close
Set oCTF = Nothing
 
Set oApp = CreateObject("Shell.Application")
 
Set oFolder = oApp.NameSpace(Source)
If Not oFolder Is Nothing Then _
    oApp.NameSpace(Destination).CopyHere oFolder.Items
 
wScript.Sleep 5000
 
Set oFile = Nothing
'On Error Resume Next
 
next
 
Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("E:\Appli\projets_" & plaque & "\ " & Centre & "\TEST\*.log"), DeleteReadOnly