Jul-24-2019, 08:46 AM
Hello,
I would like to move specific files (that have "*CT*" in filenames) from one folder to another new folder
I tried to do that with shutil but it doesnt work in my case.
I can't move files to ct directory. It created me a new file with the name "ct".
I would like to move specific files (that have "*CT*" in filenames) from one folder to another new folder
I tried to do that with shutil but it doesnt work in my case.
I can't move files to ct directory. It created me a new file with the name "ct".
ctDir = str("ct") petDir = str("pet") os.mkdir(ctDir) os.mkdir(petDir) inputPath = "C:\\data\\test2\\" print("PET files") os.chdir(inputPath) for file in glob.glob("*PT*"): print(file) petDirMove = str(petDir) + "\\" + file shutil.move(file,petDirMove) print("CT files") os.chdir(inputPath) for file in glob.glob("*CT*"): print(file) ctDirMove = str(ctDir) + "\\" + file shutil.move(file, ctDirMove)I would be appreciate for any help please.