Created
July 20, 2015 21:16
-
-
Save elbym/13ff662e2e55db45ae17 to your computer and use it in GitHub Desktop.
Chance file modififaction date from filename (after moving the gallery on andriod from the device to the sd card)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Sources which helped: | |
# http://www.brunolinux.com/02-The_Terminal/Find_and%20Replace_with_Sed.html | |
# http://apple.stackexchange.com/questions/142538/read-creation-date-from-file-name-and-change-batch | |
#for all images with EXIF Infos | |
jead -ft * | |
#for all mp4 movies | |
for f in *.mp4; do | |
t=$(echo $f | sed -E 's/_//g' | sed -E 's/.mp4//g' | sed 's/.\{2\}$//') | |
touch -t $t "$f" | |
done | |
#for all whatsapp images. the time is missing, so all images with be set to 12:00 h | |
for f in IMG*.jpg; do | |
t=$(echo $f | sed -E 's/IMG-//g' | sed -E 's/.jpg//g' | sed -E 's/-WA/1200/g' | sed 's/.\{4\}$//') | |
touch -t $t "$f" | |
done | |
#same for whatsapp, but with JEPG | |
for f in IMG*.jpeg; do | |
t=$(echo $f | sed -E 's/IMG-//g' | sed -E 's/.jpeg//g' | sed -E 's/-WA/1200/g' | sed 's/.\{4\}$//') | |
touch -t $t "$f" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment