I have a problem. I have a directory structure consisting of 34 GB worth of PDF files. But now I am in a position where I have to take out old files that are'nt being updated anymore. The problem is I dont want to base my deletion on when the folder was created, but when the file inside that folder was last updated. The structure is like this:
A -> Anderson(Folder) -> Inspections.pdf
_____________________ -> Photos.pdf
Andrews(Folder) -> Inspections.pdf
_____________________ -> Photos.pdf
I want to delete Anderson and ANdrews folders based on when the Inspections file was last saved. Since the pdf is updated more recently than when the folder is created, this presents a problem. When I do a search in explorer it ether gives me a listing of pdf files or folders. But I want the empty folders to go with the pdf files, so I need some way to extract the folders based on the last update attribute within that folder.
ANy suggestions or ideas?
How can I do this in Explorer or what program can do this?
From what I could gather, your files are laid out like this: C:\Wherever\[Letter from A-Z]\[Last Name]\Inspections.pdf. So, the following VBScript will ask for the oldest allowable date and delete all folders whose Inspections.pdf file is older. Save the file, then open it up in notepad and change the line that begins with "sLocation" to point to wherever the letter directories are kept. Then save the script.
Double-click the script to run it. You must have the Windows Scripting Host enabled to run this script -- chances are you probably do. It will ask you for the oldest allowable date. The date can actually be entered in any format you like -- "October 31, 2004" is perfectly valid -- but you're best off sticking to mm/dd/yyyy format. It will then delete all the last-name folders if the Inspections.pdf file is older than the date you entered in the input box. If the script gets confused (it expects to find an Inspections.pdf file but doesn't) it will error out, telling you where it ran into the problem.
Any problems, PM me or post here. Good luck!
Richt-Click Save-As (it was unreadable inside the code blocks).
Double-click the script to run it. You must have the Windows Scripting Host enabled to run this script -- chances are you probably do. It will ask you for the oldest allowable date. The date can actually be entered in any format you like -- "October 31, 2004" is perfectly valid -- but you're best off sticking to mm/dd/yyyy format. It will then delete all the last-name folders if the Inspections.pdf file is older than the date you entered in the input box. If the script gets confused (it expects to find an Inspections.pdf file but doesn't) it will error out, telling you where it ran into the problem.
Any problems, PM me or post here. Good luck!
Richt-Click Save-As (it was unreadable inside the code blocks).
personally i'd just use an explorer search, like you did in the past (sort date modified or something). use this to delete all the old files and then use something else to get rid of all of the resulting empty folders.
coz i imagine it's a lot easier to delete empty folders. i commonly see clean-up type programs that go through and delete all the empty folders they find.
DC's way seems pretty cool though
scratch that, i fergot you were making a descinction between the inspections.pdf file and the photos.pdf file. and also that the last-modified date of the photos.pdf file is completely irrelevant.
so my way wouldn't work.
coz i imagine it's a lot easier to delete empty folders. i commonly see clean-up type programs that go through and delete all the empty folders they find.
DC's way seems pretty cool though
scratch that, i fergot you were making a descinction between the inspections.pdf file and the photos.pdf file. and also that the last-modified date of the photos.pdf file is completely irrelevant.
so my way wouldn't work.
Right-Click Save-As
Well, here you go then. Change sLocation to where the files are now, and change sOldFilesLocation to where you want them to end up. There's also an option called bExpandOldFiles that you can use to specify whether you want the old folders to end up as C:\OldFiles\A\Anderson (bExpandOldFiles = True) or just C:\OldFiles\Anderson (= False). Good luck!
Well, here you go then. Change sLocation to where the files are now, and change sOldFilesLocation to where you want them to end up. There's also an option called bExpandOldFiles that you can use to specify whether you want the old folders to end up as C:\OldFiles\A\Anderson (bExpandOldFiles = True) or just C:\OldFiles\Anderson (= False). Good luck!