abaddon2031 0 Junior Poster in Training

Ok i had this in another question i asked yesterday and now im posting it in its own thread. I have a code that is supose to read files that are sent to me daily and after they are read i need to have them moved from their origional folder to another folder. i will attach my python code so every oen can see what im working with and if there is a simple way to do this.

import csv, datetime, os

franchiseList = {}

with open('Franchise_Name_Scrub_List.csv', 'r') as ff:
    fcf = csv.DictReader(ff)
    for frow in fcf:
        franchiseList[frow['Misc Franchise Name']] = frow
with open('Franchise_Name_Scrub_List.csv', 'r') as fF:
    fcf = csv.DictReader(fF)
    for Frow in fcf:
        franchiseList[Frow['FRANCHISE Name - Directory']] = Frow

newrow={'Last Sale Date': '', 'Last Sale Amount': '', 'First Name': '', 'Last Name': '', 'Email Address': '', 'Franchise': '', 'State': '', 'Postal/Zip Code': '', 'Last Web Order ID': '', 'Date Added': '', 'Email Source':'', 'osg_web_dir': ''}
updaterow={'Last Sale Date': '', 'Last Sale Amount': '', 'First Name': '', 'Last Name': '', 'Email Address': '', 'Franchise': '', 'State': '', 'Postal/Zip Code': '', 'Last Web Order ID': '',  'osg_web_dir': ''}
new_field_names = newrow.keys()
update_field_names = updaterow.keys()
dt = datetime.datetime.now().strftime("%m_%d_%y_%H_%M")

with open('/Users/HatterX/Desktop/Unprocessed/SOR935csv.csv', 'r') as f1, open('/Users/HatterX/Desktop/Bronto Files/FACTS_bronto_import_add_'+dt+'.csv', 'a') as f2, open('/Users/HatterX/Desktop/Bronto Files/FACTS_bronto_import_update_'+dt+'.csv', 'a') as f3:
    cf1 = csv.DictReader(f1, fieldnames=('CustNo1', 'CustNo2', 'LastOrderDate', 'LastOrderAmount', 'FirstName', 'LastName', 'UserNo', 'EmailAddress', 'Franchise', 'PrevOrderDate', 'PrevOrderAmount', 'State', 'ZIP', 'Amt1', 'Amt2', 'Amt3', 'SalesPerson', 'WEBID'))
    cf2 = csv.DictWriter(f2, new_field_names)
    cf3 = csv.DictReader(f1, fieldnames=('CustNo1', 'CustNo2', 'LastOrderDate', 'LastOrderAmount', 'FirstName', 'LastName', 'UserNo', 'EmailAddress', 'Franchise', 'PrevOrderDate', 'PrevOrderAmount', 'State', 'ZIP', 'Amt1', 'Amt2', 'Amt3', 'SalesPerson', 'WEBID'))
    cf4 = csv.DictWriter(f3, update_field_names)

    for row in cf1:
        nr = newrow
        nr['Last Sale Date'] = row['LastOrderDate'].strip()
        nr['Last Sale Amount'] = row['LastOrderAmount'].strip()
        nr['First Name'] = row['FirstName'].strip()
        nr['Last Name'] = row['LastName'].strip()
        nr['Email Address'] = row['EmailAddress'].strip().split(',',1)[0]
        if nr['Email Address'] == '':

        fr_name = row['Franchise'].strip()
        if fr_name in franchiseList:
                    nr['Franchise'] = franchiseList[fr_name]['FRANCHISE Name'].strip()
                    if nr['Franchise'] == 'IGNORE':
                    nr['osg_web_dir'] = franchiseList[fr_name]['FRANCHISE Name - Directory'].strip()
                    if nr['osg_web_dir'] == '':
                        nr['osg_web_dir'] = 'shop'
                    nr['Franchise'] = 'SHOP'
                    nr['osg_web_dir'] = 'shop'

        nr['State'] = row['State'].strip()
        nr['Postal/Zip Code'] = row['ZIP'].strip()
        nr['Last Web Order ID'] = row['WEBID'].strip()
        nr['Date Added'] = datetime.date.today().strftime('%m/%d/%Y')  
        nr['Email Source'] = 'FACTSauto'
        print nr

        ur = updaterow
        ur['Last Sale Date'] = row['LastOrderDate'].strip()
        ur['Last Sale Amount'] = row['LastOrderAmount'].strip()
        ur['First Name'] = row['FirstName'].strip()
        ur['Last Name'] = row['LastName'].strip()
        ur['Email Address'] = row['EmailAddress'].strip().split(',',1)[0]
        if ur['Email Address'] == '':

        fr_name = row['Franchise'].strip()
        if fr_name in franchiseList:
                    ur['Franchise'] = franchiseList[fr_name]['FRANCHISE Name'].strip()
                    if ur['Franchise'] == 'IGNORE':
                    ur['osg_web_dir'] = franchiseList[fr_name]['FRANCHISE Name - Directory'].strip()
                    if ur['osg_web_dir'] == '':
                        ur['osg_web_dir'] = 'shop'
                    ur['Franchise'] = 'SHOP'
                    ur['osg_web_dir'] = 'shop'

        ur['State'] = row['State'].strip()
        ur['Postal/Zip Code'] = row['ZIP'].strip()
        ur['Last Web Order ID'] = row['WEBID'].strip()
        print ur

        for filename in os.listdir("/Users/HatterX/Desktop/Unprocessed"):
         if filename.startswith("SOR935"):
             os.rename("/Users/HatterX/Desktop/Unprocessed", "/Users/HatterX/Desktop/Processed")