#!/usr/bin/perl
# SearchToNotUsePng.pl
# seesky89 20140826
# usage :
# Android Application 개발시 사용하지 않는 png 이미지 제거를 위해 만듬.
# cgywin(for Windows) 또는 리눅스에서 아래 명령 입력(상위 폴더기준)
# perl SearchToNotUsePng.pl
# 정확성을 위해 gen, bin 폴더는 삭제 필요.
use strict;
use warnings;
use File::Find;
use File::Find qw(find);
use Cwd;
my $dir = '.';
open FH, ">", "result.txt" or die "$!\n";
my $mainDir = getcwd;
print FH "Search to not use resource. you need to check.\n";
print FH $mainDir, "\n";
print FH "------------------------------------------------------------\n";
find(\&find_use_file, $dir);
close FH;
print ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n";
print "Check to result.txt\n";
print ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n";
sub find_use_file {
my $file = $_;
my $currentDir = getcwd;
if (-d $file) {
#print "skip dir : $file\n";
} elsif (-f $file) {
#print "file : $file\n";
if (/\b.9.png\b/i) {
print "search file : $File::Find::name\n";
# filename.png
my $lastindex = rindex($file, '.9');
my $search = substr($file, 0, $lastindex);
$currentDir = getcwd;
chdir('../..');
my $ret = system("find . -name -prune -o -type f \( -name '*.java' -o -name '*.xml' -o -name '*.c' \) -print0 | xargs -0 grep --color -n $search");
if($ret != 0) {
print FH $File::Find::name, "\n";
}
chdir($currentDir);
} elsif (/\b.png\b/i) {
print "search file : $File::Find::name\n";
# filename.png
my $lastindex = rindex($file, '.');
my $search = substr($file, 0, $lastindex);
$currentDir = getcwd;
chdir('../..');
my $ret = system("find . -name -prune -o -type f \( -name '*.java' -o -name '*.xml' -o -name '*.c' \) -print0 | xargs -0 grep --color -n $search");
if($ret != 0) {
print FH $File::Find::name, "\n";
}
chdir($currentDir);
} else {
#print "skip other file : $file\n";
}
}
}
2014년 8월 27일 수요일
Perl 사용하지 않는 png 이미지 찾기
사용하지 않는 png 이미지 찾아 result.txt 로 출력하는 perl.
피드 구독하기:
댓글 (Atom)
재산세
재산세에 대한 정보입니다. 재산세는 개인이나 기업이 소유한 재산에 대해 부과되는 세금으로, 주로 부동산에 대한 세금이 포함됩니다. 이 세금은 지방자치단체의 재정 수입원 중 하나로, 지역 사회의 발전과 공공 서비스 제공에 중요한 역할을 합니다. 재산세란...
-
메모리 사용량 알기 1 - heap Runtime runtime = Runtime. getRuntime (); long maxMemory = runtime.maxMemory(); long totalMemory = runtim...
-
국민연금 수령나이에 대해 알아볼께요. 국민연금은 우리나라에서 가장 중요한 사회보장 제도 중 하나로, 노후에 필요한 생활비를 지원해주는 역할을 해요. 많은 분들이 국민연금을 어떻게 수령할 수 있는지, 그리고 수령나이는 언제부터인지 궁금해 하실 텐데요...
-
Custom Annotation 선언 @Retention(용도) @Target(범위) public @interface XXX { ... } 용도 RetentionPolicy.java (java.lang.annotation) /** *...
댓글 없음:
댓글 쓰기