You want os.remove rather than shutil.rmtree. Specifically, the former method is for removing a file whereas the latter is designed to remove a directory (along with all of it's contents). for f in glob ('sub/*.sub'): subprocess.call(["php", "AES.class.php" , f]) os.remove(f) #deplacement des fichier for d in glob ('*.ass'): shutil.move(d, 'sync')...