How to find the files of a certain extension with the same exact size?

In Windows, if I have a folder with many subfolders and files of some extension, I need a command to give it the file extension, then it searches for this specific extension through all the subfolders while grouping the files of the same exact size.

Answer

It’s hard to be specific without knowing what you are trying to do. Here is a code block that might get you started.

get-childitem $HOME -recurse -filter "*.ps1" |
  group-object length |
  sort-object count -desc

This illustrates using the -recurse and -filter parameters to get a lot of files with the same extension, in this case .ps1. It then creates groups of files that have the same length. All files with length 1024 will end up in the same group. It then sorts these groups by descending hit count.

From here, you will need to learn how to work on one group at a time, and how to unpack the files from a given group.