Bonjour, je voudrais copier des fichiers et des dossiers d'un chemin à un autre mais, le problème je n'arrive pas à copier seulement les fichiers modifiés il y a moins de 1 mois par exemple à partir d'une date donnée : dtmDateModifie

Avec ce code je devrais récupérer les fichiers modifiés, il y a moins de deux jours mais ça ne fonctionne pas :/
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
88
Dim sArchive
 
'Initialisation du nom du fichier
   sFileName = "T:\Verification_Sauvegarde.txt"
     ' Récupérer l'instance du fichier.
   Set fso = CreateObject("Scripting.FileSystemObject")
   ' On récupére la date de modification du fichier .txt ou la date de la dernière sauvegarde est inscrite
If fso.FileExists("T:\Verification_Sauvegarde.txt" ) = True Then 
 Set oFile = fso.GetFile("T:\Verification_Sauvegarde.txt" ) 
 dtmDateModifie = oFile.DateLastModified
 Set oFolder = Nothing 
Else 
 dtmDateModifie = "Unknown" 
End if 
 
   Const ctePourLecture = 1
      Const varNomFic = "T:\ddletter.txt"
      Dim objFSO, objFichier, Texte, Message
      Dim Chaine, Position
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      If ( objFSO.FileExists(varNomFic) ) Then
        Set objFichier = objFSO.OpenTextFile(varNomFic, ctePourLecture)
 
        'while we are not at the end of file
        While Not objFichier.AtEndOfStream
            'we read the file line by line
            chaine = objFichier.ReadLine
           'if chain contains "archive =
            If Instr(1,chaine, "archive =") <> 0 Then
                    'we retrieve 2 chains separeted by "Version=" in a table
                    mTab = Split(chaine, " = ")
                    'we diplay the second chain in XML archive  <archive >
                    sArchive =  mTab(1) 
            End If 
 
 
 
           '-------------retourne la lettre du disque courant -------
		   'if chain contains "courant =
            If Instr(1,chaine, "courant =") <> 0 Then
                    'we retrieve 2 chains separeted by "Version=" in a table
                    mTab = Split(chaine, " = ")
                    'we diplay the second chain in XML tag <courant>
                    sCourant = mTab(1) 
            End If
 
        Wend
 
 
 
 
Dim ws,Archive,fso 
Dim Folder, path
Set ws = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
 
AgeMaximalFichiers = "2"
 
 
Archive  = "Archive_"& Day(Now) & "_" & Month(Now) & "_" & Year(Now)
 
 
path = CStr(sCourant)
 
pathDestination = CStr(sArchive & "/" & Archive)
 
 
set Folder = fso.GetFolder(path)
For Each File In Folder.Files 
dateModifie = File.DateLastModified
 If (DateDiff("d", dateModifie , dtmDateModifie) < CInt(AgeMaximalFichiers)) Then 
      'On verifie qu'ils ne sont pas en lecture seule 
    If File.Attributes And 1 Then File.Attributes = File.Attributes - 1 
 
	fso.CopyFolder path, pathDestination, true
 
        End If 
Next
 
 
 
        objFichier.Close
         Set objFichier = Nothing
      Else
        WScript.Echo "File absent"
      End If
      Set objFSO = Nothing
    WScript.Quit(0)