This post explains how to find all files with zero size from windows command prompt.
Find files with zero size
forfiles /S /M * /C "cmd /c if @fsize EQU 0 echo @path"
- If you just want to print the file name and do not need the full path, you can use @file in the place of @path.
- You can restrict the files selection to a certain type. If we need to do only for log files, you can use *.log with /M option. Example below.
forfiles /S /M *.log /C "cmd /c if @fsize EQU 0 echo @path"
Delete zero sized files
The below command would delete all zero sized files, provided the user has permissions to do so.
forfiles /S /M * /C "cmd /c if @fsize EQU 0 del @path"
Be sure to check the file list once with the echo command above.
We can even search for files with size less than certain value. For example, to find all files with less than 1KB size, the command would be
forfiles /S /M * /C "cmd /c if @fsize LSS 1024 echo @path"
You might also want to read