Tech posts by aclassifier
Also see Designer's note page

You are at
Archive by month and about me: here
Last edit: 4Sept2015
Started move: September 2012
All updates at, but the overview is updated

Saturday, July 2, 2011

026 - iOS picture sorting and file system do not tango

(2 July 2011, updated 24 October 2011)

This note discusses synching pictures on iOS units (iDevices) by letting iTunes use a disk directory for picture synching. It does not initially deal with having iTunes synch using iPhoto, but I plan to also handle that. I use Mac OS X Snow Leopard. I will update this note as time goes. If it's not been updated, it's probably because I haven't seen anything new.

iOS sorting by modification date only
Update 24.Oct.2011 with iOS 5.0: Apple seem to have gone back to alphabetical sorting again! However, in view of what I have written below, maybe they now have combined sorting methods, as I have suggested? 
Apple has decided that the iPad, iPhone or iPod (all running iOS) pictures and movies shall be sorted according to last modification date and time. It didn't start that way, but has been like that since iOS 4.

I would perhaps want iOS to let me select sorting method. Letting me choose alphabetical sorting could have been great, provided it worked. Since the alphabet I use is sortable (!?), it's a nice feature that our culture has become accustomed to. However, since camera picture names contain a number, the series would sooner or later wrap around: DSC_9999 would become DSC_0000. So any number would repeat, making alphabetical sorting difficult. And no matter how much time increases, it only seems to wrap at each big bang(?). (Being an embedded programmer I know that having a finite word length, counting the number of system clock tics does indeed overflow to zero. But that's why we're there, to know about these things.)

Maybe combining some date/time and alphabetical sorting would have been smart? The engineers at Apple of course know that being smart some times is not always that smart. The framework in which to be smart may change, and in the new context it wasn't smart any more.

So, sorting photos by date/time has come to stay. I'll have to take it in.

Vacation pictures oops.. changed!

If I change a file, cropping it, resizing it, change the light or anything, then it would now cause that picture to get today's modification date/time. Synching it with iTunes to an iOS unit would place it down at the bottom in the sorted list.

So I need to overwrite modification date by creation date

I found an AppleScript that does exactly this on the net [1]. I'll call it "TheScript" from now on. Perfect, now the photos are in lane again after the next iTunes synch also. But hey, finding it, downloading it and start to use it is not simple in any context, Apple?

Say the disk directory where iTunes finds the pictures is on a local disk, and say that TimeMachine is used for backup, then all is fine.

However, if the picture directory is on a network disk, or if as above without TimeMachine as backup, or if not only backup but also synchronization is used, then I may have a problem.

My synch program may push my pictures out of lane again!

Synching disks and synching iOS units with  iTunes are not the same thing. I'll try to be precise below. Later in 2011 Apple iCloud synching will happen without iTunes.

Skip this chapter if you always plan to run TheScript before you synchronize the disk with another disk, after having modified a file.

To get disk synchronization to work, modifying a set of files should be "atomic" with respect to disk synching. So, make yourself non-disturbable in that phase. A modified file should not be synched before TheScript!

I'll try to explain the situation that might arise if you modified a file, got disturbed, and then synched the disks "out of synch".

I use an old friend called ChronoSync. I have used it for years to synch several machines, using a network disk as the base. Whenever I change a photo, I do it at some local machine and synch the disks and then let iTunes use the synched base at the network disk for its photo synching.

However, since I have modified a photo and thus made it newer, ChronoSync will (if I run it in this phase) let the newest version survive. Later iTunes iOS synching will place the picture at the bottom.

I have found no way for the present ChronoSync to work this out. A change could be something like this, to be used after file change and we don't have TheScript:
Resolve conflict if two files have equal creation date to use the newest modified file but then change modification dates of both to become creation date
Or, how about a special synch session called iOS picture/movie synching?

I have informed Econ Technologies about this 2July11 ( (And they have replied, stay tuned)

Back to iTunes: re-date alphanumerically sorted files?

I have no way to solve this! The name of all my files have started with som number and then a sentence, like "314 pythagoras.jpg" and "271 e.jpg". The operating system understands that the characters '0'-'9' are treated as numbers and sorted accordingly. I have called this alphabetical sorting, even if it does understand fields. So the 271 file is sorted as the first.

Some times I could learn AppleScript and write a script that solves my problem: keep dates as much as possible, understand modification date and spread the set out over the dates wanted. Sorting by pushing around pictures by hand is perhaps best.. But this is difficult!

Inserting a picture or a movie into the iOS sorting sequence

Some times you need to add a picture into a sequence. Maybe you want a poster in front of each section, or the next country's flag. This is almost easy: 1.) Make a copy of the neighboring file. This has the same creation date. Experiment with the file before or after, it's not obvious how equal date/times are sorted. 2.) Open the new file in an editor. I use Graphic Convertor. 3.) Paste the image you have made prior to this so that it's inserted into the just opened picture, so that all is overwritten. You may have to delete all contents first. 4.) Save the file with the new contents. 5.) Run TheScript to make modification date from creation date.

This works for picture files.

Movies like .mov I have not been able to fix yet. Stay tuned.


[1]MacFileDatesChanger by Daniel A. Shockley, Includes some code from Paul Berkowitz and Nigel Garvey on applescript-users mailing list.


No comments:

Post a Comment

Archive and about

Popular Posts

Øyvind Teig

My photo
Trondheim, Norway

All new blogs and new home page start at

Overview of old blog notes here

My technology blog was at

and my handicraft blog was at

PS: just call me "Oyvind"