charast
asked on
VB script to Delete folders with a name that contains a date
Object:
I need a script that will allow me to remove folders older than 1 year according to the date string in the NAME of the folder (not the actual date of the folder). The script needs to be run daily and I need to be able to remove the folder and any sub-folders/files under it.
overview:
I have some logs that need to be retained for one year. They are contained in folders. These folders have been moved to a location on the network in one batch move (they all now have the same creation date). The folders have a naming structure as follows: APP09_01012008.
I have scripts that will allow me to delete folders according to the date using the creation date time stamp but I cant figure how to use a date format in a folder name string and increment it.
Thanks!
Charast
I need a script that will allow me to remove folders older than 1 year according to the date string in the NAME of the folder (not the actual date of the folder). The script needs to be run daily and I need to be able to remove the folder and any sub-folders/files under it.
overview:
I have some logs that need to be retained for one year. They are contained in folders. These folders have been moved to a location on the network in one batch move (they all now have the same creation date). The folders have a naming structure as follows: APP09_01012008.
I have scripts that will allow me to delete folders according to the date using the creation date time stamp but I cant figure how to use a date format in a folder name string and increment it.
Thanks!
Charast
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
script worked perfectly and even allowed use of a UNC path.
You would just need to change the values of the objStartFolder an dthe intDaysOld variables.
Open in new window