list files based on conditions

Occasional Visitor

Need to list files  from multiple paths with its full path, date & time info. The condition is it has to exclude files owned by a specific user and also exclude files from certain folders

1 Reply

@sandeep1947 

Try this quick one

 

$Paths=@('C:\AttendanceReport','C:\Chocolatey')
Get-ChildItem $Paths -Recurse | get-acl | where {($_.path -notlike "*\dontInclude\*") -and ($_.Owner -notlike "*System*")}