This problem has probably been solved a few times but I couldn't find it. I would like to count a specific type of files in a drive and sort them based on their creation date. Basically I want to know how many .RAW files I create every year. The files are in multiple folders on the drive in question.
I have tired to play arond with: dir /a:-d /s /b "H:" | find /c /v ".RAW" it counts something, but I cant figure out how to get the creation time as well.
any ideas ? All the best Morten
You could get the assistance of PowerShell:
%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Command "$RAWfiles = Get-ChildItem -ErrorAction SilentlyContinue -File -Filter '*.RAW' -Path 'H:\' -Recurse | Where-Object {($_.CreationTime).Year -Eq (Get-Date).Year}; $Listing = ForEach ($File In $RAWfiles) {New-Object PSObject -Property @{FileName = $File.FullName; Created = $File.CreationTime.ToString('yyy-MM-dd')}}; $Listing | Sort-Object -Property CreationTime | Format-Table FileName, Created -HideTableHeaders; Write-Host 'Total File(s):' $RAWfiles.Count"
The above example is designed only to output files created this year. If you run it next year, it will output the files created in that year instead. If this does not achieve your overall intention, and as this is not a code writing service, I will leave any modifications to you.