[wellylug] Programming Question

Damon Lynch damon at photo.geek.nz
Thu Nov 27 08:13:39 NZDT 2003


On Thu, 2003-11-27 at 20:44, Jethro Carr wrote:
> 
> I need to make a program which can run another program on top of it,
> so I can run another program, like cp to copy a file, and then continue
> on with the program.
> 
> 
> Does anyone know how I can do this?
> 

Here is an example python program (note os.system call, that's what you
need if you use python):

import os

for f in os.listdir('.'):
    if f.find('.jpg') > 0:
        tempfile = f[:-1] + 't'
        os.system('jpegtran -rotate 90 %s > %s' % (f, tempfile))
        os.remove(f)
        os.rename(tempfile, f)





More information about the wellylug mailing list