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
| Dim objFileSystemObject, fsO, FL, FD, strFolderPath, oFSO, oFld
Dim oShell, oExec, sK, ScriptPath
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")
strFolderPath = "F:\CopyTool"
If Not objFileSystemObject.FolderExists(strFolderPath) Then
msgBox("Vérifiez que le lecteur USB3.0 est bien référencé en lecteur réseau F:\, ou bien vérifiez qu'il existe bien un répertoire CopyTool sur le disque de données.")
Else
Set FD = fso.GetFolder("F:\CopyTool\Database")
FD.Name="Data"
End If
Set fso = Nothing
Set FD = Nothing
Set fso = CreateObject("Scripting.FileSystemObject")
path = "C:\bvsys\TurnoutView3.7.2\Parameter\Directories.var"
content = fso.OpenTextFile(path,1).ReadAll
With New RegExp
.Global = True
.Pattern = "W:\\SIM09\\[^\\]+"
srepl = .Replace(content, GetRef("repl"))
End With
fso.CreateTextFile(path,True).Write srepl
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")
strFolderPath = "W:\SIM09\" & Date
CreateFullPath = False
If Not objFileSystemObject.FolderExists(strFolderPath) Then
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CreateFolder (strFolderPath)
'msgbox("Dossier Date créé")
If Err.number <> 0 Then
CreateFullPath = False ' Error while creating
Call Err.Clear()
End If
On Error Goto 0
Else
CreateFullPath = True
'msgbox("Le dossier Date existe déjà")
End If
Set objFileSystemObject = Nothing
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oCrFld= CreateObject("Scripting.FileSystemObject")
set oFld = oFSO.GetFolder("F:\CopyTool\Data")
oCrFld.CreateFolder("W:\SIM09\" & Date & "\Data")
oFld.Copy "W:\SIM09\" & Date & "\Data",True
set oFld = oFSO.GetFolder("F:\CopyTool\RawData")
oCrFld.CreateFolder("W:\SIM09\" & Date & "\RawData")
oFld.Copy "W:\SIM09\" & Date & "\RawData",True
set oFld = oFSO.GetFolder("F:\Zoes")
oCrFld.CreateFolder("W:\SIM09\" & Date & "\Zoes")
oFld.Copy "W:\SIM09\" & Date & "\Zoes",True
WScript.Quit
Function FolderExists(strFolderPath)
Dim fileObject
Set fileObject = CreateObject("Scripting.FileSystemObject")
On Error Resume Next ' Si erreur, continuer
FolderExists = fileObject.FolderExists(strFolderPath)
If Err.number <> 0 Then
FolderExists = False
Call Err.Clear()
End If
On Error Goto 0
Set fileObject = Nothing
End Function
Function repl(m,p,s)
repl = "W:\SIM09\" & Date
End Function |
Partager