Copie des fichiers d'un emplacement vers un autre.
Syntaxe
object.CopyFile (source, destination)
Arguments
FileSystemObject.Les exemples suivants illustrent l'utilisation de la méthode CopyFile :
Exemple 1 :
Function CopySingleFile(source, destination)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile source, destination
End Function
'Usage
CopySingleFile "C:\Temp\test.txt", "C:\Temp\dest\"
'Note – If Source file doesn’t exist, an empty file will be created at
destination
Exemple 2 :
Function CopyMultipleFiles(source, destination)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile source, destination
End Function
' Usage
CopyMultipleFiles "C:\Temp\*.txt", "C:\Temp\Destination\"