04-14-2009 07:33 AM
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
Solved! Go to Solution.
04-14-2009 07:49 AM
04-15-2009 06:42 AM
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
04-15-2009 01:51 PM
04-16-2009 08:38 AM
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
04-16-2009 10:06 AM
04-16-2009 11:07 AM
I am using Labview 8.5 and VBAI 3.5.
MartyP
04-16-2009 12:06 PM
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.
04-16-2009 12:28 PM
Thank you, I will try this and let you know how it works.
MartyP
04-23-2009 07:00 PM
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