디지털 사진 파일명을 exif 정보를 이용하여 일괄변경하기...

haneulso의 이미지

리눅스 초보자입니다.
디지털 사진이 너무 많고 파일명이 제각각이어서 고민하다가 각 사진파일에 들어있는 exif정보를 파일명으로 변경해 주는 명령어를 발견하였습니다.

 exiv2 -r '%Y%m%d-%H%M%S-photo' -k rename *.jpg

위와 같이 하면 저 명령어가 실행된 디렉토리에 있는 jpg 사진 파일은 이름이 "20130709-193751-photo.jpg"와 같은 형태로 바뀝니다.

그런데 하위디렉토리에 있는 파일은 전혀 영향이 없어서 하위 디렉토리에서 다시 명령을 실행해 주어야 합니다.

exiv2 옵션에도 그런 내용은 없고요.

다른 명령어와 연계해서 쓰면 될 듯 한데

영 알 수가 없습니다.

방법이 없을까요?

감사합니다.

shint의 이미지

- 스크립트가 잘 안되면. C 로 프로그램을 만들어도 될것 같습니다.
- exiv2 로 해보니. .jpg 파일에. EXIF 정보를 잘 인식하지 못합니다.
인식되는 프로그램 예제나 블로그. 도구 등을 알아봐야 할거 같습니다.

//
하위 디렉토리로 이동해서. 이름 변환 실행

find ./ -type d -iname "*" -exec bash -c 'mv $0/*.txt $(echo "$0/*.vvv")' '{}' \;

이러면 될거 같것 같은데. 모르죠 ㅇ_ㅇ;;

find ./ -type d -iname "*" -exec bash -c 'exiv2 -r '%Y%m%d-%H%M%S-photo' -k rename *.jpg' '{}' \;

//
sudo apt-get install exiv2

여기 이미지로 테스트 해봤는데.
exiv2 -r '%Y%m%d-%H%M%S-photo' -k rename *.jpg

exif-samples/jpg/
https://github.com/ianare/exif-samples/tree/master/jpg

인식을 잘 못합니다. ㅇ_ㅇ;;
root@goorm:/workspace/test4/src# exiv2 -r '%Y%m%d-%H%M%S-photo' -k rename *.jpg
Exiv2 exception in rename action for file Canon_40D.jpg:
Canon_40D.jpg: The file contains data of an unknown image type
Exiv2 exception in rename action for file Canon_40D_photoshop_import.jpg:
Canon_40D_photoshop_import.jpg: The file contains data of an unknown image type
Exiv2 exception in rename action for file Fujifilm_FinePix6900ZOOM.jpg:
Fujifilm_FinePix6900ZOOM.jpg: The file contains data of an unknown image type

//
디렉토리 전체 경로 얻는 방법

tree ./ -dfi

//
하위 디렉토리 리스트를 얻는 방법

find ./ -type d

tree
https://www.computerhope.com/unix/tree.htm
https://unix.stackexchange.com/questions/232564/how-to-make-tree-output-only-files
https://www.cyberciti.biz/faq/linux-show-directory-structure-command-line/

find
https://stackoverflow.com/questions/5456120/how-to-only-get-file-name-with-linux-find

bash
https://stackoverflow.com/questions/16541582/finding-multiple-files-recursively-and-renaming-in-linux

rename
https://unix.stackexchange.com/questions/42022/how-can-i-rename-all-files-in-the-current-directory-having-a-particular-extensio

//
exif - 코드 프로젝트 예제
https://www.codeproject.com/search.aspx?q=exif&doctypeid=1%3b2%3b3%3b13%3b14

----------------------------------------------------------------------------
젊음'은 모든것을 가능하게 만든다.

매일 1억명이 사용하는 프로그램을 함께 만들어보고 싶습니다.
정규 근로 시간을 지키는. 야근 없는 회사와 거래합니다.

각 분야별. 좋은 책'이나 사이트' 블로그' 링크 소개 받습니다. shintx@naver.com

haneulso의 이미지

자세한 답변 감사합니다. 많은 도움이 될 듯합니다^^

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.