Scirpt help

Welcome Forums General PowerShell Q&A Scirpt help

This topic contains 2 replies, has 2 voices, and was last updated by

2 years, 2 months ago.

  • Author
  • #57284

    Points: 0
    Rank: Member

    I have *.ktx files that are in c:\inet\pub\upload directory with about 500 subdirectories. I need to create a txt file that lists all the ktx file paths between these dates: 2016-11-04 06:50 a.m. to 2016-11-08 08:25 a.m.
    Of all the sub folders i need to exclude the "archive" folder.

    Does this seem right?

    Get-ChildItem C:\inet\pub\uploads\ -recurse -include @("*.ktx") |
    Where-Object {$_.CreationTime -gt "11/04/2016" -and $_.CreationTime -lt "11/08/2016"} |
    Select-Object FullName, CreationTime, @{Name="Mbytes";Expression={$_.Length/1Kb}}, @{Name="Age";Expression={(((Get-Date) – $_.CreationTime).Days)}} |
    Export-Csv C:\report.txt

    thanks for any help. I am a newb ! Split

  • #57341

    Points: 44
    Rank: Member

    That should be about right... Did it work for you?

  • #57347

    Points: 0
    Rank: Member

    i ended up using a few diff commands and it appears to be working. I am at 2000 files and still counting and 2x checking to see if they are valid. they appear to be.

    Get-childitem c:\inetpub\uploads -recurse | where-object {$_.lastwritetime -gt '11-04-2016 6:50:00 am' -AND $_.lastwritetime -LT '11-08-16 8:25:00 am' -AND ! $_.PSIsContainer} | select-object fullname | Export-Csv C:\report.txt

    thanks for checking it. Split

The topic ‘Scirpt help’ is closed to new replies.