You are not logged in.

#1 2008-07-20 23:55:35

sinister99
Member
Registered: 2007-04-10
Posts: 136

Using jhead to make filename comment [solved]

All my pictures are named, and I want to copy the name to the jpeg comment.  Looks like jhead would work with jhead -cl string file, and I'm trying to figure out that magic command that will take all my files in a directory and copy the filename to the comment field.

Best I can come up with so far is

jhead -cl $F *.JPG

but that needs a lot of work.  Can anyone help me out?

Last edited by sinister99 (2008-07-22 12:17:47)

Offline

#2 2008-07-22 01:39:41

Varreon
Member
Registered: 2008-07-03
Posts: 95

Re: Using jhead to make filename comment [solved]

Heres a bash script to do it:

#!/usr/bin/bash
for x in $(ls *.jpg)
do
jhead -cl $x $x
done

Offline

#3 2008-07-22 02:00:36

sinister99
Member
Registered: 2007-04-10
Posts: 136

Re: Using jhead to make filename comment [solved]

That almost works, the only problem is some pictures have spaces in their names, and it doesn't work for those.

Offline

#4 2008-07-22 04:04:29

Varreon
Member
Registered: 2008-07-03
Posts: 95

Re: Using jhead to make filename comment [solved]

Okay, heres a modified version:

ls|while read i; do jhead -cl $i $i; done

Offline

#5 2008-07-22 07:38:46

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Using jhead to make filename comment [solved]

you could do ls -1 smile


I need real, proper pen and paper for this.

Offline

#6 2008-07-22 10:52:51

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Using jhead to make filename comment [solved]

no no! for i in *.jpg
and surround $i in quotes.

Offline

#7 2008-07-22 12:17:25

sinister99
Member
Registered: 2007-04-10
Posts: 136

Re: Using jhead to make filename comment [solved]

I got it, thanks to all for the help

ls -1|for i in *.JPG; do jhead -cl "$i" "$i"; done

Offline

#8 2008-07-22 14:18:26

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Using jhead to make filename comment [solved]

for i in *.JPG is enough actually lol It's expanded.


I need real, proper pen and paper for this.

Offline

Board footer

Powered by FluxBB