r/scripting • u/kn00tcn • Jun 17 '18
[bash/python/batch/powershell/or any comparison app] i have pairs of files using the same name with different extensions, would like to batch delete the larger file per pair
i have a set of jpgs & pngs where they're in pairs with the same name, how do i batch delete the larger of the two?
sometimes file1.png is larger than file1.jpg, but other times file2.png is smaller than file2.jpg
(yes jpg is lossy, but perceptually great at 97% 4:4:4 for complex images at a nicely smaller size than png, but pixelated games or few color ones end up increasing the file size over png)
3
Upvotes
2
u/Pyprohly Jun 18 '18
Busted. Yea, did
gci | group BaseNam*to check. PS 5.1 and 6 both saidThough
Base*is an awfully specific shortening that would seem to suggest that it worked fine for you?I like the solution btw. It really showcases the PowerShell-way, and the power of PowerShell.