From: Kenny McCormack on
In article <i2uh7h$7d7$00$1(a)news.t-online.com>,
Tuxedo <tuxedo(a)mailinator.com> wrote:
....
>Good to know. However, I have no jhead on the Linux I use, which is not
>even a known distribution, let alone package managers of any kind.

But you do have a C compiler, right?

--
> No, I haven't, that's why I'm asking questions. If you won't help me,
> why don't you just go find your lost manhood elsewhere.

CLC in a nutshell.

From: Tuxedo on
Rikishi42 wrote:

> On 2010-07-28, Tuxedo <tuxedo(a)mailinator.com> wrote:
> >> I'm not on the system that script is on, but if you'd like to try it,
> >> just give a yell, and I'll find it for you.
> >
> > Yes, this sounds great! I'd like to give it a try if you would be so
> > kind to make it available somewhere.
>
> Mind that this is something I had to cobble together real quick to sort
> out my sister's 4500 pictures in a *very* big hurry for xmas, 2 years ago.
> It's ugly, but it works. I just had a test run on a batch of pictures.
>
> Go to http://www.rikishi42.net/SkunkWorks/Junk/ and take a copy of the 3
> files starting with 'exif'. I put them in my ~/bin/ directory. Make'em
> executable.
>
>
> Right, so try this on a copy first. Say you put your test files in a dir
> called ~/pics_test/ .
>
>
> cd ~/pics_test
> find ./ -maxdepth 1 -type f -iname '*.jpg' -exec exif_date.py '{}' ';'
>
>
> It will:
> - create a dir 'Exif_out' in your dir
> - create a dir with the date (yyyymmdd) in 'Exif_out'
> - rename each file to 'yyyymmdd_hhmmss__OriginalPictureName.jpg'
> and move it into 'Exif_out/yyyymmdd/'
> - NOT touch files where the Exif date can't be found
>
>
> We can allways change/remove the base dir, subdirs and file names. Just
> give a yell.
>
>
> Have fun !
>

I just tested the Python script and found it works perfectly fine on my
system, so thanks for making this available.

I would just like a slightly different filename result.

To use one example, if an image named 'img_9424.jpg' exists in the
directory, a sub directory will be created in Exif_out/20100521 as the
picture was taken according to the exif data on 21st May 2010. The image
file itself is then named to '20100521_150221__img_9424.jpg'. In other
words, the new filename reflects not only the date but also the exact time.

Using the Python script, as it currently made, is it possible to keep the
image name unchanged? I mean so that img_9424.jpg will not include the
prepended parts prior to the old filename. As the Python script places
relevant images in sub-directories by date anyway there is no risk of
conflicting image names on any one day. The camera I use will not reset its
count procedure to take two different images named img_0001.jpg on a single
day, at least not without taking over 9999 images in the one single day.

Alternatively, how can I batch rename images in a working directory
according to a regex that simply removes the characters prior to and
including the first two consecutive underscores found in the filename?

In other words, for the image named: ..
20100521_150221__img_9424.jpg

.... a (sed/perl/shell/pything) script or command would rename the image to
'img_9424.jpg'.

Many thanks for any tips how this may be done.

Tixedo

From: Rikishi42 on
On 2010-08-08, Tuxedo <tuxedo(a)mailinator.com> wrote:
> To use one example, if an image named 'img_9424.jpg' exists in the
> directory, a sub directory will be created in Exif_out/20100521 as the
> picture was taken according to the exif data on 21st May 2010. The image
> file itself is then named to '20100521_150221__img_9424.jpg'. In other
> words, the new filename reflects not only the date but also the exact time.
>
> Using the Python script, as it currently made, is it possible to keep the
> image name unchanged? I mean so that img_9424.jpg will not include the
> prepended parts prior to the old filename. As the Python script places
> relevant images in sub-directories by date anyway there is no risk of
> conflicting image names on any one day. The camera I use will not reset its
> count procedure to take two different images named img_0001.jpg on a single
> day, at least not without taking over 9999 images in the one single day.

Sure. I had put that info in because my sister and brother-in-law had
pictures from multiple cameras. So including the time allowed them to see
the pictures in the correct order, regardless of the source camera. And they
could then also group pictures of multiple days in one single dir (eg: a
holiday trip) and still keep some order. It also allows to collect pictures
in one dir on a CD-rom to be sent to the print shop, without the risk of
colliding names.

A new file (exif_tuxedo.py) if now on the server. Just run that.


> Alternatively, how can I batch rename images in a working directory
> according to a regex that simply removes the characters prior to and
> including the first two consecutive underscores found in the filename?
>
> In other words, for the image named: ..
> 20100521_150221__img_9424.jpg
>
> ... a (sed/perl/shell/pything) script or command would rename the image to
> 'img_9424.jpg'.
>
> Many thanks for any tips how this may be done.

I _told_ you to run it on a test set. :-)

I'm sure someone can come up with a script for that. Doing it in Python is
trivial, but I'm running late for work as it is. :-)

If you get no solution, give a yell.



--
When in doubt, use brute force.
-- Ken Thompson
From: Tuxedo on
Rikishi42 wrote:

[...]

> Sure. I had put that info in because my sister and brother-in-law had
> pictures from multiple cameras. So including the time allowed them to see
> the pictures in the correct order, regardless of the source camera. And
> they could then also group pictures of multiple days in one single dir
> (eg: a holiday trip) and still keep some order. It also allows to collect
> pictures in one dir on a CD-rom to be sent to the print shop, without the
> risk of colliding names.

I see the point. I also have two different cameras so your original version
will be helpful on other occasions.

> A new file (exif_tuxedo.py) if now on the server. Just run that.

Many thanks for the tuxedo version of your directory creation and image
reorganisation by exif date script! I now have two options and I will
probably make regular use of both versions.

[...]

> I'm sure someone can come up with a script for that. Doing it in Python is
> trivial, but I'm running late for work as it is. :-)

Indeed I found a simple solution in a later post. I just didn't want to
tamper with your python procedures in case I'd brake something.

> If you get no solution, give a yell.

I'm all set, my batch of 5000+ holiday images are neatly organised by date.

Thanks again!

Tuxedo