Set-StrictMode -Version Latest
$From="C:\from"
$To="C:\to"
$DaysAgo="10"
$LastAccess =(get-date).AddDays(-$DaysAgo)
get-childitem $From -include *.* -recurse | ? {
!$_.PsIsContainer -and $_.LastAccessTime -le “$LastAccess”
} | % {
$newpath = join-path $To $_.DirectoryName.SubString($From.length)
New-Item $newpath -type directory -ErrorAction SilentlyContinue
Move-Item $_.FullName -destination $newpath
write-host "File Was Last Accessed" $_.LastAccessTime
$outputfilename = ( "c:\"+$DaysAgo+"dayReport.csv")
$_ |format-table -property Fullname |out-file $outputfilename -append
}
We could do that, I was seeing about getting it done without all that leg work.
We want to move the data, so it is out of the "Live" share.