-
-
Save tomjcleveland/867c7dc840807d48532372cf51c38793 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
echo "Adding EXIF data to photos...\n" | |
while IFS="," read -r id filename created | |
do | |
created_parsed=`echo $created | sed 's/-/:/g'` | |
created_parsed=`echo $created_parsed | sed 's/T/-/g'` | |
created_parsed=${created_parsed%?????} | |
echo "" | |
echo "ID: $id" | |
echo "Filename: $filename" | |
echo "Created: $created_parsed" | |
eval "jhead -ts$created_parsed -mkexif $2/$filename" | |
touch -d "$created" "$2/$filename" | |
done < <(tail -n +2 $1) |
@nickcaplan I had the same "touch: illegal option -- d" issue. I installed coreutils (brew install coreutils
) and then modified exif.sh
to use gtouch
instead of touch
. After that it worked!
This solution was based on this thread
Hope that helps you out
Hi Tom, thanks for this. I am a total novice muddling my way through this so please forgive me for any clangers.
There are 766 photos I am trying to add metadata to using this guide:
chrome-extension://cicalpgkgmacgnbnnkhdgpnicipnihgo/exif.html
I on a Macbook air with Catalina 10.15.7. I have installed homebrew, Xtools, and jhead.
I've had the following response in terminal. Any ideas what I have done wrong?
/Users/Louis/Desktop/exif.csv: line 1: Id,Filename,Timestamp: command not found
/Users/Louis/Desktop/exif.csv: line 2: 10101540579069596,57454629_10101540579074586_5209883175014105088_n.jpg,2019-05-13T21:05:06.000Z: command not found
This continues up to line 767. As there are 766 photos I thought maybe the header line in the csv file was confounding things so I tried deleting that but got the same response.
Oh, this is what I'm typing in:
Firstly this because initially it was telling me permission denied to the csv file:
chmod +x /Users/Louis/Desktop/exif.csv
Then:
./exif.sh ~/Desktop/exif.csv ~/Desktop/Facebook download_files
@racoonsmac I believe I had a permission denied issue at first and tried perl exif.sh
instead of ./exif.sh
and that fixed it for me
Got from this fix from this thread
Thanks for this Tom,
I'm getting the script to run, but it gives me the same error for every file. I've tried it normally and then also per the above comment, where I've installed coreutils (brew install coreutils) and then modified exif.sh to use gtouch instead of touch, but still doesn't work.
I am NOT gttting the "touch: illegal option -- d" error"
Would appreciate anyone's help here. Thanks
ID: 1013459381275
Filename: 225830_1013459381275_3496_n.jpg
Created: 2006:12:17-04:55:33
Error : No such file
in file '/Users/gz/Desktop/fb_photos_files/225830_1013459381275_3496_n.jpg'
gtouch: cannot touch '/Users/gz/Desktop/fb_photos_files/225830_1013459381275_3496_n.jpg': No such file or directory
Oh, this is what I'm typing in: Firstly this because initially it was telling me permission denied to the csv file:
chmod +x /Users/Louis/Desktop/exif.csv
Then:
./exif.sh ~/Desktop/exif.csv ~/Desktop/Facebook download_files
Thanks a lot 👍 I had to change the chmod for exif.sh too and it went smoothly!
Well I'm getting similar errors and haven't found a solution that works.
Error : No such file
in file '/250547_519432241465_1055_n.jpg'
touch: /250547_519432241465_1055_n.jpg: Read-only file system
I've tried chmod
to change permissions, switching to gtouch
in exif.sh
, installing coreutils
, and trying perl
/sudo
before the script.
Hi all!
Sorry for the radio silence here—this project has been on the back burner for a while. But I have good news!
I've added a feature to the Tagged Photo Exporter extension that will add Exif timestamps to all your exported photos just by clicking a button:
This seemingly-simple feature actually requires a server-side component and is a bit expensive to run, so for now it's a (cheap) paid feature. I hope this helps!
Hey Tom - thanks for putting this together.
I just tried to run it on a bunch of photos but I got lots of these errors:
ID: 552786910438
Filename: 1927737_552786910438_5015_n.jpg
Created: 2006:11:12-12:46:35
Error : No such file
in file '/Users/Nick.Caplan/Desktop/temp/FB_tags/FB_photo_files/1927737_552786910438_5015_n.jpg'
touch: illegal option -- d
usage:
touch [-A [-][[hh]mm]SS] [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...
But each of the files in the error message (ending "_n.jpg" do exist). Do you know what I might have done wrong?
I am using a Mac on Catolina, with zsh terminal.
Thanks in advance!