Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Organising photos into a list (O/T)
- X-seq: zsh-users 11253
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Organising photos into a list (O/T)
- Date: Fri, 9 Mar 2007 13:59:54 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <Xns98EE6824D7FF6zzappergmailcom@xxxxxxxxxxx> <070309035844.ZM6380@xxxxxxxxxxxxxxxxxxxxxx> <200703091237.l29CbP80026608@xxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Peter Stephenson <pws@xxxxxxx> wrote in news:200703091237.l29CbP80026608
@news01.csr.com:
> Bart Schaefer wrote:
>> On Mar 9, 10:15am, zzapper wrote:
>> }
>> } I needed to organise about 60 images into a numerical list.
>> [...]
>> } (Just realised, the best way would have been to print them all and
then
>> } organise them on a table: but that would have taken ages)
>>
>> If the file names or dates don't already reflect something close to the
>> ordering you want, so you have to look at the pictures to number them,
> # Get the list of files as currently ordered
> array1=(*)
> # Output one per line to a file
> print -l $array1 >file
> # Edit the file. Just reorder the lines the way you want.
> vi file
> # Put the ordered files into a new array
> array2=(${(f)"$(<file)"})
> # Sanity check
> (( ${#array1} != ${#array2} )) && print 'Wrong number of files!'
> # Rename files into a subdirectory, which
> # prevents overwriting. (This is paranoia if
> # your are adding numbers.)
> mkdir newnames
> # Use 3 digit numbers (arbitrary).
> integer -Z 3 i
> typeset name
> # For each file in the required order...
> for (( i = 1; i <= ${#array2}; i++ )); do
> name=$array2[i]
> # Move into the subdirectory tagged with the new position as index.
> mv $name newnames/${i}_$name
> done
>
Peter,
Yes that's the way to do it!
Now why couldn't you have told me this yesterday <G>!!!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author