On Jan 5, 2008 1:58 PM, Mike Kershaw <[EMAIL PROTECTED]> wrote:
>
> On Sat, Jan 05, 2008 at 01:49:51PM -0500, John Mort wrote:
> > I have a crontab script that pulls map files (a PNG) from an online
> > game once a day, and stores them in a folder named after the date.
> > Games are numbered from 33 to 70, in this way I can have a time stamp
> > on the state of each game every day.
> >
> > I've been collecting this for several months, and would like to turn
> > these collections of pictures into movies to post on the forums, so
> > that people can see how each game has flowed over time. On my own
> > I've figured out how to write a script to make a new folder for each
> > game, then copy map files for each day into it's respective folder,
> > renaming them to the date they were taken.
> >
> > I was planning on using mencoder to try to make them into a movie, but
> > the mencoder documentation says the pictures need to be in numerical
> > order. I altered the script to rename it this way by using cp
> > $sourcefile /$game/day$i.png, where $i is incremented, resulting in
> > the files being called day1.png, day2.png, day3.png, etc.
> >
> > I was wondering if there was a way to do this so that it would instead
> > call them day001.png, day002.png, day003.png, etc? I don't know yet
> > if mencoder is going to count "1, 10, 11, 12, ... , 19, 2, 20, 21,
> > ..." or not, but I know that sometimes it's useful to have things
> > spaced out this way and I'd like to know how to do it, just haven't
> > found anything that tells me how to do it in bash yet. Any
> > suggestions?
>
> let n=0;
> for f in *.jpg; do
> name=foo-`printf "%04d" ${n}`
> cp ${f} ${name}
> let n=${n}+1
> done
>
> (or mv, or whatever. I suggest some non-destructive tests first, use
> backups! :)
>
> -m
>
> --
> Mike Kershaw/Dragorn <[EMAIL PROTECTED]>
> GPG Fingerprint: 3546 89DF 3C9D ED80 3381 A661 D7B2 8822 738B BDB1
>
> Todays lesson is always to ignore your feelings and listen to the robot head.
>
> _______________________________________________
> Mid-Hudson Valley Linux Users Group http://mhvlug.org
> http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug
> Upcoming Meetings (6pm - 8pm) MHVLS Auditorium
> Dec 5 - Open Source Show and Tell
> Jan 2 - TBD
> Feb 6 - DBUS
> Mar 5 - Setting up a platform-independent home/small office network using
> Linux
>
>
Okay, so printf is available in bash. I wonder why I didn't think to
look for that. Thanks!
--
John D. Mort
http://john.mort.net
_______________________________________________
Mid-Hudson Valley Linux Users Group http://mhvlug.org
http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug
Upcoming Meetings (6pm - 8pm) MHVLS Auditorium
Dec 5 - Open Source Show and Tell
Jan 2 - TBD
Feb 6 - DBUS
Mar 5 - Setting up a platform-independent home/small office network using
Linux