This PowerShell code below, will get the lists of all the pictures and files on the "My Pictures" folder.
It will also include the file size for each picture or file.
The code will sort by file size and type.
So jpg, bmp and png files will be sorted according to its file size.
Here's the code:
==========================
$xFiles = [Environment]::GetFolderPath('MyPictures')
$yItems =Get-ChildItem -Recurse -af $xFiles | Select-Object "Name","Length"
foreach ($yyItems in $yItems) {
$xyLength = $yyItems.Length / 1mb
$xstringLength = $xyLength.ToString().substring(0,5)
write-host $yyItems.Name "----" $xstringLength "MB"
}
==========================
To sort using command line, check out link below:
http://quickbytesstuff.blogspot.sg/2014/04/sort-files-using-command-line.html
Hope it helps!!! Cheers!
Comments
Post a Comment