Hey,
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.Code:Option Explicit on error resume next Dim FileSystemObj Dim FolderPath Dim folder Dim FileList Dim File Dim DaysOld '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 File.Delete(True) End If Next '______________________________________________________ 'Tidy up Set FileSystemObj = Nothing Set folder = Nothing Set FileList = Nothing Set File = Nothing
Any help would be greatly appreciated.
Thanks.



LinkBack URL
About LinkBacks


