Please can someone assist me with a project we are working on. We use HMIs to log data to a USB drives connected directly to the HMIs. Our client requires access to these files via FTP. The HMI has an FTP area that can be accessed however there is no direct way of copying these folders between locations. I can run some VB script in the background and trigger the sub routine from the PLC.
Not knowing anything about VB scripts I'm struggling to get this to work.
This code only works if the date is included: IO.DirectoryInfo("\UsbDisk\Data Logging\Log Files\DataSet0\yyyymmdd")
.
A new folder is created every night at midnight with a new date, so having a fixed date will only work for that day. Ideally I want the copy to copy everything from "UsbDisk\Data Logging\Log Files", ignoring the "DataSet0\yyyymmdd".
Thanks in advance.
Sub Test
Dim di As New IO.DirectoryInfo("\UsbDisk\Data Logging\Log Files\DataSet0\20191126")
Dim Diar1 As IO.FileInfo() = di.GetFiles()
Dim dra As IO.FileInfo
For Each dra In Diar1
System.IO.File.Copy(dra.FullName, "\User\SysmacHMI\FTP\" + dra.Name,True)
Next
End Sub