From: Tuxedo on
Janis Papanagnou wrote:

[...]

> Oops! Reading pk's proposal I apparently missed that you want them all
> beneath a single directory level. So what I proposed may not suit you.

That's good too, it can be useful for another purpose.

Tuxedo


From: Tuxedo on
Loki Harfagr wrote:

[...]

> idea posted in c.u.q. reposted here as you curiously multi-posted that Q.
> ,-)

I know, my mistake. I don't cross-post normally. I posted there first but I
meant to post here as I think this is a busier and equally relevant
newsgroup.

>
> this little trick should do:
>
> $ ls -l *.jpg | awk '{d=$6;sub(/^.*:.../,"\"");sub(/$/,"\"");printf("( [
> -d %s ] || mkdir %s ) && mv %s %s/\n",d,d,$0,d)}' | sh
>
> of course use with your own "selector" (*.jpg *.png / find... whatever)
> obviously you may prefer to check what it'd do before actually doing it,
> then just redirect the output and only activate the moves when dry and
> high, e-g:
>
> $ ls -l *.jpg | awk '{d=$6;sub(/^.*:.../,"\"");sub(/$/,"\"");printf("( [
> -d %s ] || mkdir %s ) && mv %s %s/\n",d,d,$0,d)}' > /tmp/wooof $ sh
> /tmp/wooof

Thanks,
Tuxedo
From: Tuxedo on
Rikishi42 wrote:

> 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.

Many thanks, I downloaded the 3 script files. Out of the different
solutions posted above it sounds ideal since I always transfer files
between different machines via ftp on a local network, so modification
dates may not reflect the time and date of when photos are taken.

Tuxedo

From: Tuxedo on
Geoff Clare wrote:

> Rikishi42 wrote:
>
> > I'm using a date from the picture's EXIF information, to file them by
> > image ceation date (scan or photo taken). This information is inside the
> > file and less likely to change. Of course, the EXIF info should be
> > present in the files.
> >
> > The script I use is in Python, and based on their EXIF example script.
>
> You can do the same job with the jhead tool (use the -n option).
> It should be easily installable on any system (on Debian it's
> apt-get install jhead).
>
> Disclaimer: I often use jhead for other things, but have never
> used the -n option. I'm assuming it works as described in the
> man page.
>

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.

Tuxedo




From: Janis Papanagnou on
On 30/07/10 14:21, Tuxedo wrote:
> Janis Papanagnou wrote:
>
> [...]
>
>> Oops! Reading pk's proposal I apparently missed that you want them all
>> beneath a single directory level. So what I proposed may not suit you.
>
> That's good too, it can be useful for another purpose.

Certainly. And if you want your simpler directory structure you just need
to remove the gsub() function.

Creating a directory tree:

for f in img_*.jpg
do
d=$( stat -c%y "$f" | awk '{gsub(/-/,"/",$1); print $1}' )
mkdir -p "$d"
mv -- "$f" "$d"/"$f"
done

Creating a flat directory structure:

for f in img_*.jpg
do
d=$( stat -c%y "$f" | awk '{print $1}' )
mkdir -p "$d"
mv -- "$f" "$d"/"$f"
done


Janis

>
> Tuxedo
>
>