Page 1 of 1

list files with full path and size

Posted: 08 Sep 2014 18:13
by yky
How do I list files with the full path and size? "Dir /s /b" lists files with full path but no file size.

My computer is full of peculiar executable files. For every folder, there is a corresponding executable with the same name. For example, there are executables named "Program Files.exe" and "Windows.exe" in C:\ . Every such file has the exactly same size: 46620.

I am thinking of deleting them by first listing all files with full path and size then using the find command to filter off files whose size is not 46620 and name doesn't contain ".exe". The problem is I don't know how to do the first step - listing files with full path and size.

Any help will be greatly appreciated.

Re: list files with full path and size

Posted: 08 Sep 2014 23:26
by foxidrive
It can be done in batch but also in Windows search.

Configure the search to search the hard drive (by default in Vista+ it only searches indexed files)
and search for *.*

Then sort the results by clicking on the size column where you can look at the files of that size.

It sounds a bit like malware...

You can also use the advanced search to find only files of that size, I think.

Re: list files with full path and size

Posted: 08 Sep 2014 23:37
by foxidrive
A simple way to get a quick list is this:

Code: Select all

dir c:\ /a-d /s |findstr /i /c:"c:\\" /c:" 46,620 "


You could also use dir c:\*.exe there if you only need to locate exe files.

Re: list files with full path and size

Posted: 14 Sep 2014 04:47
by yky
Thanks to everyone who replied to my question.

I found that the following command does what I want:

forfiles /s /M *.exe /c "cmd /c echo @path @fsize"

This command lists .exe files with their full path and size. From there I can filter off those whose size is not 46620.

Re: list files with full path and size

Posted: 16 Sep 2014 00:42
by yky
I posted the following reply few days back but it is gone. Not sure what happened.

I found that the following command would do what I want:

forfiles /s /M *.exe /c "cmd /c echo @path @fsize"

Re: list files with full path and size

Posted: 19 Sep 2014 21:42
by Ed Dyreen
yky wrote:I posted the following reply few days back but it is gone. Not sure what happened.
Posts from new members need to be approved before they become public.

Re: list files with full path and size

Posted: 18 May 2015 22:54
by Ben Mar
yky wrote:
"I found that the following command does what I want:
forfiles /s /M *.exe /c "cmd /c echo @path @fsize"
This command lists .exe files with their full path and size. From there I can filter off those whose size is not 46620.

You can filter it right in one pass like this:

Code: Select all

forfiles /s /M *.exe /c "cmd /c if @fsize equ 46620 echo @path @fsize"