Doug
asked on
VB.NET, delete non-animated GIF files, recurse through folders\subfolders; Out Of Memory Exception
I have a huge file repository of images that has tens of thousands of files and probably close to as many folders. I thought I'd write a quick script or app that will recurse through the folders and subfolders, check to see if the image is an animation, and if not, delete the file. It was easy with the 1 or 2 test files but I'm getting an "Out Of Memory" exception when I try to do it with a folder that contains more than 200 files. I've attached my vb.NET form1.vb file.
The form only has 1 "Start" button to kick the process off.
Form1.vb
The form only has 1 "Start" button to kick the process off.
Form1.vb
Whoops! I forgot to finish a line : \
Dim gifs() As String = System.IO.Directory.GetFiles("C:\your\top\level\dir", "*.gif", System.IO.SearchOption.AllDirectories)
For Each strFileName As String In gifs
FileProcessing(strFileName)
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks I'll give this a shot tomorrow.
ASKER
ASKER
Points increased
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Really strange, I could have sworn I used the "Select All" button then copied and pasted.
I see what you mean by the multithreaded being more efficient and that will be phase 2 of this if this is something I'm going to use more often.
Thank you. You saved me a good chuck of time and taught me something along the way which is why I love E.E.
I see what you mean by the multithreaded being more efficient and that will be phase 2 of this if this is something I'm going to use more often.
Thank you. You saved me a good chuck of time and taught me something along the way which is why I love E.E.
Open in new window