Original: http://www.cnblogs.com/cnpirate/archive/2013/07/23/3208865.html
This script scans the current directory for pictures larger than 50k, and the output file is in 2.txt.
One scenario for this script is to scan the Res directory for the Android project, and to alert the image files larger than 50K to prevent programmers from adding too large a picture, resulting in a apk file for the final production installation package.
@echo off setlocal enabledelayedexpansion
@if exist 1.txt (
@del 1.txt/q
)
@if exist 2 . txt (
@del 2.txt/q
)
Call:docheckbigfile.
echo "done."
@exit/b 0
:d ocheckbigfile
pushd%1
for/f%%i in (' dir/s/b *.png ') do (echo%%~fzi >> 1.txt)
for/f%%i in (' dir/s/b *.jpg ') does (echo%%~fzi >>1.txt)
for/f "tokens=1* delims="% A in (1.txt) do (
Set "zer=%%a"
Set "pat=%%b"
I F!zer! GTR 51200 (
if not "!pat:~0,-1!" = = "%~0" echo "!pat:~0,-1!" & Echo "!pat!" >>2.txt
)
@if exist 1.txt (
@del 1.txt/q
)
popd
@exi T/b 0