import os

for subject in range(13):
    os.mkdir("/home/USER/fmri-experiments/predication/design/generated-experiments/subject-%02d/video"%(subject+1))
    os.mkdir("/home/USER/fmri-experiments/predication/design/generated-experiments/subject-%02d/video/pymvpa"%(subject+1))
    os.mkdir("/home/USER/fmri-experiments/predication/design/generated-experiments/subject-%02d/text"%(subject+1))
    os.mkdir("/home/USER/fmri-experiments/predication/design/generated-experiments/subject-%02d/text/pymvpa"%(subject+1))
    f1 = open("/home/USER/fmri-experiments/predication/design/generated-experiments/subject-%02d/raw/pymvpa/attributes"%(subject+1), "r")
    f2 = open("/home/USER/fmri-experiments/predication/design/generated-experiments/subject-%02d/video/pymvpa/attributes"%(subject+1), "w")
    f3 = open("/home/USER/fmri-experiments/predication/design/generated-experiments/subject-%02d/text/pymvpa/attributes"%(subject+1), "w")
    for line in f1:
        n = line.split(" ")[1]
        if "video" in line:
            f2.write(line)
            f3.write("rest "+n)
        elif "text" in line:
            f2.write("rest "+n)
            f3.write(line)
        else:
            f2.write(line)
            f3.write(line)
    f1.close()
    f2.close()
    f3.close()
