Reputation: 1
import os
from shutil import copyfile
os.chdir('Z:/')
print (os.getcwd())
infile = open("NFO.nfo","r")
for f in os.listdir ():
file_name, file_ext = os.path.splitext(f)
file_nfo = file_name+'.nfo'
print (file_nfo)
shutil.copyfile (infile, file_nfo)
infile.close()
Upvotes: 0
Views: 13
Reputation: 33285
infile
is a file object, but copyfile()
requires file names.
If you want to copy the same source file every time, use the name:
shutil.copyfile ("NFO.nfo", file_nfo)
Upvotes: 1