Skip to main content

Blog

How to check empty file in batch

Recently during a project we have worked on in Inforbiro we have needed to check if some files are empty or not using batch on Windows environment. We have thought that it would be extremely simple (at the end it was) but research taken time :)

So we created a script for our needs and share the code with you hoping that it would be useful.

{mobile_block=responsive_ad_728_90}

Copy the code into a file, save it with .bat extension and run it passing a file for checking as a parameter. For example:

C:\check_empty.bat C:\file_for_checking.txt