[Tutor] File Copying on Win98

Timothy Brauch tmbrau00@centre.edu
Wed, 07 Mar 2001 01:14:48 -0500


> > import os
> >
> > contents_0=os.listdir('../CIM2kCD/')
> >
> > try:
> >     os.mkdir('C:/Program Files/CIM2k/')
> > except: pass
> >
> > for item in contents_0:
> >    file=open('../CIM2kCD/'+item,'rb').read()
> >##  new=open('C:/Program Files/CIM2kCD/'+item,'w')
       new=open('C:/Program Files/CIM2k/'+item,'wb')
This is my first change

> >##  new.write('C:/Program Files/CIM2k/'+item)
       new.write(file)
And here is another change I needed to make.

I also need to change from 'w' to 'wb.'  The picture files looked very
odd using just 'w'.

Thanks for all your help

 - Tim