$pathname = "C:\Users\kelly.garcia"
$files = Get-ChildItem $pathname -Recurse -File |
Where-Object LastAccessTime -le (Get-date).AddMonths(-1)
foreach ($f in $files)
{
$Name = $f.name
#Compress-Archive $f -DestinationPath $pathname\$Name.zip
}
Compress-Archive : The path '2013-09-18 10.57.31.jpg' either does not exist or is not a valid file system path.
At line:4 char:1
+ Compress-Archive $f -DestinationPath $pathname\$Name.zip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (2013-09-18 10.57.31.jpg:String) [Compress-Archive], InvalidOperationException
+ FullyQualifiedErrorId : ArchiveCmdletPathNotFound,
Open in new window