Scirpt help

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Split Split 3 weeks, 5 days ago.

  • Author
    Posts
  • #57284
    Profile photo of Split
    Split
    Participant

    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
    Profile photo of Charles Downing
    Charles Downing
    Participant

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

  • #57347
    Profile photo of Split
    Split
    Participant

    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

You must be logged in to reply to this topic.