Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

deleting images on cvs

Solved!
Go to solution

I am trying to limit the number of images stored on my CVS when programming in VBAI. This feature works fine until the unit is powered down. After it is powered up it starts counting over and the images that were stored prior to powering down remain on the drive. Can I create a VI in Labview to delete image files by creating a file path based on date or time that would delete files more than two days old ? If I do this would the VI be part of the VBAI inspection or would it be stored on the CVS hard drive and called up when it needs to run. I think I would run it only on start-up so it doesn't slow down my inspection. If anyone can offer any advise I sure would appreciate it.

 

Thanks,

MartyP

0 Kudos
Message 1 of 12
(4,809 Views)
Have you had a look at the Advanced File Functions palette which is in File I/O? You have the List, File/Directory Info and Delete nodes which togther should take care of what you are trying to do. Not sure if this is available in VBAI but you can write a simple application in LabVIEW which uses those nodes.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 2 of 12
(4,809 Views)

I see where I can List the files and folders,and delete the ones I don't want but I don't see where the CVS will determine that they are more than two days old and delete only these. Can I use a compare function and delete anything previous to two days ago? Or do I need to build a file path using the time stamp and subtract or decrement the date ? I can see where what you suggested will work if I enter the dates that I want to delete manually, but if I wanted to do that I would do it in MAX and not bother writing program at all. All I have at the machine is the PLC for machine control and the CVS for the vision system. The CVS on a network and I am accessing the stored images via FTP. My intent is to automatically delete older images so that the system doesn't require any maintenance.

 

MartyP

0 Kudos
Message 3 of 12
(4,789 Views)
If you look at the File/Directory Info VI, it has an output called last mod that gives you a time stamp.  You should be able to compare this to the current time and delete the file if it hasn't been touched in a certain amount of time.
Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 4 of 12
(4,774 Views)

Using the delete function I can delete a specific file or entire folder. Using the file/directory info function I can view the last mod date/time. What I cant figure out is how to create a file path to delete multiple files at the same time based on the last mod date. I need to delete 100 to 150 files but I don't want to loose the entire folder.

 

MartyP

0 Kudos
Message 5 of 12
(4,756 Views)
I actually built a program to do this.  Let me know which version of LabVIEW you're using and I'll post it.
Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 6 of 12
(4,747 Views)

I am using Labview 8.5 and VBAI 3.5.

 

MartyP

0 Kudos
Message 7 of 12
(4,741 Views)

See attached library.  You should be able to change the controls to constants and have the VI run on startup of your CVS.  I very (and I mean very) lightly tested this so please check it before you put it into use.

 

Also, not sure if you will need this, but one possible upgrade to make is to check the file type before deleting it.  Let me know if you have any other feedback on it.

Alex Person
NI-RIO Product Support Engineer
National Instruments
Message 8 of 12
(4,738 Views)
Solution
Accepted by topic author MartyP

Thank you, I will try this and let you know how it works.

 

MartyP

0 Kudos
Message 9 of 12
(4,735 Views)

This works well for deleting files, I replaced the variables with constants as you suggested.  I think the only thing I would still like to do is delete the files that are more than two days old compared to the last modification time in the folder rather than the current timestamp. This would eliminate deleting all of the files after a three day weekend and insure there are still two days of images on my CVS. I appreciate the help from all who responded.

 

Thank you,

MartyP

0 Kudos
Message 10 of 12
(4,668 Views)