Stripping Files out of Dirs
I am looking to create a program/script that will go through 1 directory and look for the file extension .jpg . Now, this directory will have subdirectories and I need the program to be able to read and parse through those as well.
I tried something in VBscript, but would like to do the same in C++
This code also deletes the files if they are 30 days old. I need it to be able to do that. However, this script does not go through subdirectories. I kind of pieced this code together from other VB sites and help from others.
on error resume next
'set how far back to delete
DaysOld = 30
Set FileSystemObj = CreateObject("Scripting.FileSystemObject")
'set the directory
FolderPath = "C:\ImageDir"
set folder = FileSystemObj.GetFolder(FolderPath)
set FileList = folder.Files
'test each file's age and delte if older than DaysOld
For each File in FileList
If File.DateLastModified < (Date() - DaysOld) Then
Set FileSystemObj = Nothing
Set folder = Nothing
Set FileList = Nothing
Set File = Nothing
Any help would be greatly appreciated.