Sub copyFiles()
Dim myFolders(), srcFolder As String, j, pdfFile As String, destFolder As String
destFolder = "C:\Commissioning Database\PDFReports\"
srcFolder = "\\servername\data\CxFiles\"
myFolders = Array("ATR", "IIF", "RIF", "StartUp", "ConstructionsDwgs", "FPT", "Spec", "FAT")
For j = LBound(myFolders) To UBound(myFolders)
pdfFile = Dir(srcFolder & myFolders(j) & "\*.pdf")
While pdfFile <> ""
FileCopy srcFolder & myFolders(j) & "\" & pdfFile, destFolder & myFolders(j) & "\" & pdfFile
pdfFile = Dir
Wend
Next
End Sub
|