Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 06-08-2007
rocinante rocinante is offline
Registered User
 

Join Date: Jun 2007
Posts: 21
Here are the details

Greetings,

I am new to scripting, but find if I can see the code working for a given problem, then I can eventually figure it out.

So, If ye dare, if yes be brave enough, then step forward to help me with this ---please.

I've just loaded a CD's worth of reference images. The images follow a naming scheme such as DSCN-1.JPG, DSCN-2.JPG ... DSCN-10.JPG, although the frame numbers may be noncontiguous (i.e., there may be gaps between numbers).

Although the frames were stored in separate directories on the
CD-ROM from which they were loaded, all of the frames have now been
placed into this directory:

/shots/roc/home/pix/out/home_test_v1/misc_bg8

The structure of the directory I've loaded them into is this:

/shots/$SHOWNAME/$SHOTNAME/pix/out/$ELEMENTNAME/$RESOLUTION_$COLORSPACE

I have to rename the frames in accordance with standard
naming conventions. These include:

1. No capital letters in the filenames

2. No dashes allowed in the filenames

3. The images should be re-numbered so that they are a contiguous
sequence (i.e. no gaps)

4. Frame numbers need to be padded to four-digits. ie, "1"
becomes "0001" This is denoted by the symbol # so a range of
1-240 would read 1-240#.

5. The frames should be renamed to match the directory in which
they are placed in the following manner:

$ELEMENTNAME_$RESOLUTION_$COLORSPACE.#.$EXTENSION

So, in other words, each frame should become:

/shots/roc/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0001.jpg
/shots/roc/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0002.jpg
/shots/roc/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0003.jpg
...
/shots/roc/home/pix/out/home_test_v1/misc_bg8/home_test_v1_misc_bg8.0240.jpg

However, the incoming frames are part of a series and must be kept in the exact same order as they were when loaded (i.e., the incoming frame with the lowest index will
map to `home_test_v1_misc_bg8.0001.jpg', while the second lowest index will map
to `home_test_v1_misc_bg8.0002.jpg', and so on). Hint: sorting by name is not enough!


Sample usage:
$ roc_cd2spi /shots/spi/home/pix/out/home_test_v1/misc_bg8