[WinCC Flexible] Script IHM copie fichier SD vers USB
Posté : 09 avr. 2023, 23:06
Bonjour à tous, sur un IHM tp900 comfort, sur lequel j'ai une carte SD et une clé usb, j'aimerai par script, effectuer une copie de tous les fichiers situés d'un dossier de la carte SD vers la clé usb.
J'ai essayé le script ci-dessous, mais sans succès.
Merci pour votre aide pour comprendre d'où vient mon erreur.
Sub exportHistoriqueSurUsb()
Dim fso, filename, SourcePath, DestinationPath, check
DestinationPath = "\Storage Card USB\"
SourcePath = "\Storage Card SD\data\"
'' Create the File system object to the file system of the panel
Set fso = CreateObject ("FileCtl.file")
' Search for files in the destination directory and delete them.
filename = fso.Dir(DestinationPath & "*",0)
Do Until filename = ""
fso.kill DestinationPath & filename
filename = fso.Dir
Loop
'Search For files In the Source directory And copy them To the Destination directory
filename = fso.Dir(SourcePath & "*",0)
Do Until filename = ""
fso.filecopy SourcePath & filename, DestinationPath & filename
filename = fso.Dir
Loop
' Clean object fso
Set fso = Nothing
J'ai essayé le script ci-dessous, mais sans succès.
Merci pour votre aide pour comprendre d'où vient mon erreur.
Sub exportHistoriqueSurUsb()
Dim fso, filename, SourcePath, DestinationPath, check
DestinationPath = "\Storage Card USB\"
SourcePath = "\Storage Card SD\data\"
'' Create the File system object to the file system of the panel
Set fso = CreateObject ("FileCtl.file")
' Search for files in the destination directory and delete them.
filename = fso.Dir(DestinationPath & "*",0)
Do Until filename = ""
fso.kill DestinationPath & filename
filename = fso.Dir
Loop
'Search For files In the Source directory And copy them To the Destination directory
filename = fso.Dir(SourcePath & "*",0)
Do Until filename = ""
fso.filecopy SourcePath & filename, DestinationPath & filename
filename = fso.Dir
Loop
' Clean object fso
Set fso = Nothing