Contents

조회 수 2415 댓글 0
Atachment
첨부 '1'
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

사진 파일 정렬하고 차례대로 넘버링 하려고 만듦 ㅋㅋ


#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>

int main(){
    DIR *dir_info;
    struct dirent *dir_entry;
    char new_name[128];
    int i;

    //mkdir( "test_A"     , 0755);

    dir_info = opendir( ".");

    if ( NULL != dir_info){
        //while( (dir_entry = readdir( dir_info)) ){
        for(i =0; (dir_entry = readdir( dir_info)); i++){
            if( strstr(dir_entry->d_name, ".jpeg") > 0 ){
                printf( "%s\n", dir_entry->d_name);

                memset(new_name, 0x00, 128);
                sprintf(new_name, "IMG_%04d.JPG", i);
                rename(dir_entry->d_name, new_name);
            }
        }
        closedir( dir_info);
    }
}



?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
1105 Etc WM미통기 - 10. 조건부확률 hooni 2015.04.20 2261
1104 Develop [ios] VIN Scanner (VIN barcode) 스캐너 file hooni 2017.09.16 2273
1103 Develop [git] 쉬운 버전관리 Git 설명 hooni 2015.08.18 2276
1102 Develop [ios] 비디오,네트워크,소셜로그인 테스트 file hooni 2017.04.04 2286
1101 Etc 수리통계학 : 표본공간과 사상-1 hooni 2015.04.20 2297
1100 Develop [ios] UIWebView를 이용한 로컬 HTML 파일 표시 file hooni 2015.01.02 2315
1099 System/OS [linux] yum 업데이트 시 커널 제외하기 hooni 2014.09.11 2326
1098 Develop [ios] iOS 앱 아이콘을 만드는 유틸 file hooni 2015.01.03 2330
1097 Develop [ios] UIView 계층구조 hooni 2015.01.03 2333
1096 Develop 리팩토링 계획안 file hooni 2017.05.15 2358
1095 Develop [ios] Crashlytics, Fabfic 설치/설정 hooni 2016.07.21 2368
1094 Develop [ios] 오브젝티브C→스위프트, 코드 변환 손쉽게 file hooni 2015.08.07 2383
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 99 Next
/ 99