5

Is there anyway to identify files which have not been accessed inside the last [insert time frame here] (for me its inside the last year) via a windows share?

I have access to the server and the files are only ever accessed via the windows share and never from the server itself.

The share has 70GB of data on it (NTFS). It has hundreds of thousands of files spread out within hundreds of folders. A mixture of MS Office related files, largish images, programs and more.

I'm primarily a programmer and am happy with a 'roll your own by doing this' answer... but I'd love there to be a mechanism in Windows (SBS Server 2003), an open source tool or a inexpensive commercial product.

Obviously I am keen that the tool helps me actually action this somehow. Having a list with which to manually work with the files is not the desired final outcome but is definitely a good start.

2
  • I sometimes send notes out to people to clean up their disk space on shared storage. After adequate warning, I move them to another drive (As long as there's a backup) and then when people start questioning things, put those particular files back. Not feasible in most cases, but it seems to help for awhile get people to clean things up when necessary. Jun 23, 2010 at 12:51
  • In your case, probably not feasible, but for smaller shares it's worked. :-) Jun 23, 2010 at 12:51

1 Answer 1

3

PowerShell:

$Cutoffdate = (Get-date).AddDays(-365)
Get-Childitem –recurse \\server\share\folder | where-object {$_.LastAccessTime –gt $Cutoffdate}

And if you want to do something like move them:

$Cutoffdate = (Get-date).AddDays(-365)
$Destdirectory = '\\server\share\oldfiles'
Get-Childitem –recurse \\server\share\folder | where-object {$_.LastAccessTime –gt $Cutoffdate} | foreach {$_.MoveTo($Destdirectory)}

I should warn you that this isn't a perfect process. Windows doesn't keep track of Access Time very well, and you're likely to miss quite a few files that haven't actually been accessing in a long time, but someone has browsed the directory they're in (which sometimes updates the atime, other times not).

2
  • That worked but it appears that, like you stated, the files have been 'accessed' (I'm guessing virus scanner & thumbnail generation) even when they weren't being 'used'. :( but your solution appears to be very close to what I need, thank you. Jun 23, 2010 at 13:06
  • The operator should be -lt instead of -gt otherwise you will get newer files.
    – Jozef Woo
    Dec 25, 2020 at 14:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .