Forum Discussion

sandeep1947's avatar
sandeep1947
Copper Contributor
Nov 13, 2020

list files based on conditions

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

  • farismalaeb's avatar
    farismalaeb
    Steel Contributor

    sandeep1947 

    Try this quick one

     

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

Resources