A script to scan a large image

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.