Picture rename: Difference between revisions
From Elch-Wiki
				
				
				Jump to navigationJump to search
				
				
 Created page with "== Problem == Gewisse Digi-Cams numerieren die Bilder einfach fortlaufend, statt den Filenamen aus dem Aufnahmedatum zu bilden  == Lösung == <pre>picrename.sh</pre> im Home  == Script == <pre> #!/usr/bin/bash  for file in *JPG do # Uncomment if the file-create/-modify date should be modified to change e.g. timezones! #   touch -d "$( date -d @$(( $(stat -c '%Y' $file) - 12*60*60 )) )" $file      # Take the file-create/-modify date as the new filename     newfile=$(date..."  | 
				No edit summary  | 
				||
| Line 2: | Line 2: | ||
Gewisse Digi-Cams numerieren die Bilder einfach fortlaufend, statt den Filenamen aus dem Aufnahmedatum zu bilden  | Gewisse Digi-Cams numerieren die Bilder einfach fortlaufend, statt den Filenamen aus dem Aufnahmedatum zu bilden  | ||
== Lösung ==  | == Lösung 1 ==  | ||
<pre>exiftool -d '%Y%m%d_%H%M%S%%-03.c.%%e' '-filename<CreateDate' . </pre>  | |||
[https://photo.stackexchange.com/questions/103767/how-can-i-rename-files-to-match-their-exif-created-date#103771 Source]  | |||
== Lösung 2 ==  | |||
<pre>picrename.sh</pre> im Home  | <pre>picrename.sh</pre> im Home  | ||
== Script ==  | === Script ===  | ||
<pre>  | <pre>  | ||
#!/usr/bin/bash  | #!/usr/bin/bash  | ||
Revision as of 11:38, 28 May 2023
Problem
Gewisse Digi-Cams numerieren die Bilder einfach fortlaufend, statt den Filenamen aus dem Aufnahmedatum zu bilden
Lösung 1
exiftool -d '%Y%m%d_%H%M%S%%-03.c.%%e' '-filename<CreateDate' .
Lösung 2
picrename.sh
im Home
Script
#!/usr/bin/bash
for file in *JPG
do
# Uncomment if the file-create/-modify date should be modified to change e.g. timezones!
#   touch -d "$( date -d @$(( $(stat -c '%Y' $file) - 12*60*60 )) )" $file
    # Take the file-create/-modify date as the new filename
    newfile=$(date +"%Y%m%d_%H%M%S_$file" -d "$(stat -c "%y" $file)")
    
    # Rename
    mv "$file" "$newfile"
done