Matthew Page

Omron NA Copy Files from USB to FTP

7 posts in this topic

Please can someone assist me with a project we are working on. We use NA HMIs to log data to a USB drives. 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 to copy everything from (UsbDisk\Data Logging\Log Files) ignoring the (DataSet0\yyyymmdd")

'Code behind Page - Add local subroutines for the page.

Sub Test

Dim di As New IO.DirectoryInfo("\UsbDisk\Data Logging\Log Files\DataSet0\20191127 ")

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

Share this post


Link to post
Share on other sites

Anyone come up with a solution to this? I'm also trying to access data logs via FTP.

Share this post


Link to post
Share on other sites

I tried to do it, I manage to copy the folders and files from each folder, but not yet the sub-folders .

rob5029 , what do you want to do ?

 

Share this post


Link to post
Share on other sites

We have some data logs running on the HMI, at present I have to go to site and remove the memory card from the HMI to transfer the files to my laptop.

With the older NS screens you can FTP direct to the memory card, and download the files remotely. On the NA they have a dedicated FTP folder, and only files within that folder can be accessed remotely, and there is no option to save the log files direct to the FTP folder.

I spoke to Omron technical help and they sent me this:
https://www.support-omron.fr/details/iag.php?id=2017-03-09%20-%2014-57-37%20-%201628257134

Which should give the ability to copy the contents of the SD card to the FTP folder and visa versa, I haven't tried it yet so not sure if it works. But you would have to use the VNC interface to remote control the HMI and navigate to the screen that this function block has been inserted on and manually execute the command prior to FTP download.

I'm waiting for a new HMI to be delivered so I can try this on a test bench rather than on the live plant.

Cheers
Rob.

Share this post


Link to post
Share on other sites

may be  you can copy the log files every day or week by a subroutine to the ftp .

i don't know how work VNC but that's true you can copy files of SD to FTP or USB .....

 

Share this post


Link to post
Share on other sites

I bet you can write a script the copies files between USB/SD/FTP directory. 

That IAG for file manager works great, I have used it to get files from a USB onto the SD card many times.  I added a USB port on the front of my demo, cabled to the back of the HMI, and the HMI has an SD installed. 

I made a project that has the IAG full screen.  I use the backup/restore function in the HMI to load it from the SD card.  Then I plug a USB drive into the extension cable on the front of the machine, copy the files I need, and then use backup/restore to put the HMI project back.  Obviously you can put the IAG into a page in the HMI, like a maintenance page, and load it from there, but I have 8 different projects I switch the HMI between and didn't want to update them all.

Share this post


Link to post
Share on other sites

Here an example to copy file received on NA5 FTP from external client to NA5 program:

Sub FTPCopyFile(filename As String)
	If System.IO.File.Exists(filename) Then
		System.IO.File.Copy(System.IO.Path.Combine("\User\SysmacHMI\FTP\", filename), System.IO.Path.Combine("\User\SysmacHMI\", filename), True)
		System.IO.File.Delete(System.IO.Path.Combine("\User\SysmacHMI\FTP\", filename))
	End If
End Sub

To specify a device with an absolute path, place "\" before the name. (eg. \UsbDisk\Sample.csv)

Name Supported version Description
UsbDisk V1.00 Signifies the USB Memory inserted in USB Host Port 1.
UsbDisk2 V1.00 Signifies the USB Memory inserted in USB Host Port 2.
SDCard V1.00

Signifies an SD Memory Card.

FTP

V1.03 Signifies the folder that can be accessed externally via FTP.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now