Thanks all,
I got it to work using:

import os

import shutil



destination_prefix="/Data/test/"

source_prefix="/Data/test1/"


for year in range(2011, 2013):

year = str(year)

for month in range(1, 13):

# convert to a string with leading 0 if needed

month = "%02d" % month

source = os.path.join(source_prefix, year, month+"/")

#print source


 destination = os.path.join(destination_prefix, year, month+"/")

for files in os.listdir(source):

print files

filepath=os.path.join(source, files)

 print "copying", files, "from:", source, "to:", destination

shutil.copy(filepath, destination)
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to