Moving around files and fun things of that sort.
tjreedy at udel.edu
Tue Aug 27 21:43:06 CEST 2002
"Micah Mayo" <astrophels at yahoo.com> wrote in message
news:57e0b28.0208271010.516f2caa at posting.google.com...
> respectively. Here is what I'd like to do, basically:
> x = 0
> for x in range (17):
> os.system('cp -p source[x] destination[x]')
> if os.path.getsize(source[x]) !=
> print 'Size not verified, do you wish to contnue?'
> (this is pseudo-code, so don't worry about specific syntax)
> my problem is this will not work with the os.system method. There
> isn't a way that I can find that will allow me to mix these arrays
> with the system command. So a) is there a way for python to copy the
> files w/o using the os.system, or is there a way to make os.system
You need to construct and pass os.system a string that contains the
for pair in zip(source,destination):
os.system('cp -p %s %s' % pair)
However, you might as well write the file list as one list of pairs in
the first place:
srcdest = (
This would be easier to maintain (edit) when list changes. Then write
for pair in srcdest:
> Please e-mail me, as I am posting this through google.
Terry J. Reedy
More information about the Python-list