I have a shared directory tree on a Windows 2003 file server that has about 100GB worth of data in it. I need to find all top-level directories in this share where the last modification time for every file in every subfolder hasn't been modified sine 1/1/11. Essentially, I'm looking for shares that are abandoned.
The directory structure looks something like this:
-a
--a1
--a2
--a3
----a3_1
-b
--b1
--b2
-c
--c1
----c1_1
etc
What I want to do is find out if everything that's not a hidden file under a or b or c has a mod date before or after 1/1/11.
So far, I can find the mod times after a year for each file with this:
get-childitem "\\server\h$\shared" -recurse | where-object {$_.mode -notmatch "d"} |
where-object {$_.lastwritetime -lt [datetime]::parse("01/01/2011")}
What I don't know how to do is check each top level directory individually to see if all of the files contained within it are older than a year. Any ideas?