use shutils to copy a file

This commit is contained in:
Elan Ruusamäe 2011-02-07 00:29:51 +02:00
parent acf08e8fe8
commit e2c88692f0

View file

@ -29,6 +29,7 @@
# #
import sys, os, os.path, re import sys, os, os.path, re
import getopt import getopt
from shutil import copyfile, copystat
from os import listdir from os import listdir
from os.path import isdir, basename from os.path import isdir, basename
@ -104,9 +105,8 @@ def copy_attachments(page_dir, attachment_dir):
for attachment in attachments: for attachment in attachments:
src = os.path.join(dir, attachment) src = os.path.join(dir, attachment)
dst = os.path.join(attachment_dir, attachment.lower()) dst = os.path.join(attachment_dir, attachment.lower())
cmd_string = 'cp -p "' + src + '" "' + dst + '"' copyfile(src, dst)
print cmd_string copystat(src, dst)
os.system(cmd_string)
def convert_markup(content, filename): def convert_markup(content, filename):
""" """