I am in the process of teaching myself to use Python as it is a commonly used language here at my internship/job.
What I am trying to do is move all the files within two directories into a combined folder, but i only want the files themselves not the folder structure. Below is the code I have so far, its nothing remarkable, but I feel as if I am perhaps just missing a useful library and/or method.
ResultFail & ResultPass -> Results
I greatly appreciate your time and help
#Python Script to gather Results files #Author Riv3r import os import shutil import platform def toString(tmp): if(tmp == CCMA): #print("at A") return "CCMA" elif(tmp == CCMB): #print("at B") return "CCMB" else: #print("at C") return "CCMC" #capture login of the machine usr = os.getlogin().upper() #List of each individual machine by CCMx CCMA = ["card1", "card2", "card3" , "card4" , "card5",] CCMB = ["card6", "card7", "card8", "card9", "card10",] CCMC = ["card11", "card12", "card13", "card14", "card15",] #List of every machine in test group labMachines = [CCMA, CCMB, CCMC] filepath =  for CCMx in labMachines: #print(toString(CCMx)) for name in CCMx: #print(name) if(name == usr): break platform = CCMx break #print(toString(platform)) srcFolder = "C:\login_name\TRs" dstFolder = "::file location::" + toString(platform) tmp = 0 while(tmp < 2): try: for file in os.listdir(srcFolder): #filepath = os.path.join(srcFolder, file) #not being used anymore shutil.move(srcFolder, dstFolder) except WindowsError: print("Error!") # can't copy file access times on Windows pass tmp = tmp + 1 print("Execution Finished!")
This post has been edited by Riv3r: 03 July 2013 - 07:56 AM