Develop

file copy

작은이야기 2014. 4. 10. 21:10
import os
import shutil
from os import listdir
from os.path import isfile, join

onlyfiles = [ f for f in listdir('.') if isfile(join('.',f)) and f[-3:] == 'png' ]


for f in onlyfiles:
    a = f[:-5]
    c = os.path.join(os.getcwd(), f)
    print f
    for i in range(5):
        b = a + str(i+1) + '.png'
        print b
        dstdir =  os.path.join(os.getcwd(), b)
        shutil.copy(c, dstdir)