Contents

Views 754 Comment 0
Atachment
Attachment '1'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

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


#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
No. Category Subject Author Date Views
805 Develop [php] 쉘에서 실행할 때 인수(파라미터) 받기.. hooni 2003.04.23 11588
804 Develop [js] 자바스크립트로 응용프로그램 실행 ㅎㅎ hooni 2003.04.23 9812
803 Develop [php] URL/URI 관련 환경변수 hooni 2003.04.23 9151
802 Develop [js] 쿠키(cookie)에 대한 설명과 예제.. hooni 2003.04.23 8321
801 Develop [js] 스크롤을 포함한 마우스 위치 찾는 코드 hooni 2003.04.23 8505
800 Develop [c] pcap을 이용한 패킷 분석 ㅎㅎ hooni 2003.04.23 10210
799 Develop [linux] 쉘 스크립트를 이용한 BBS hooni 2003.04.23 10047
798 Develop [unix] 쉘 스크립트 예제 모음 hooni 2003.04.23 14949
797 Develop [c] 간단한 자료구조(stack, queue, linked list) 구현 소스 6 file hooni 2003.04.23 10113
796 Develop [c] 파일입출력, 링크리스트(linked list)를 이용한 주소록(도스용) 소스코드 1 file hooni 2003.04.23 11147
795 Develop [c] 테트리스(Tetris) 게임(도스용) 소스코드 file hooni 2003.04.23 11475
794 Develop [c] flooding 알고리즘 미로 찾기(도스용) 소스코드 9 file hooni 2003.04.23 12509
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71