Author Posts

November 9, 2016 at 8:59 pm

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

November 10, 2016 at 2:16 pm

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

November 10, 2016 at 3:09 pm

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