mardi 26 juillet 2016

Python, copy only directories

I have a program that has a list of some files. I have to copy only the directories and the subdirectories from the list to a specified directories and don't need to copy the files. I tried this, but it doesn't work. def copiarDirs(): items = list.curselection() desti = tkFileDialog.askdirectory() for dirs in os.walk(items, topdown=False): for name in dirs: #for i in items : aux=root+"/"+list.get(i) tryhard=("cp "+str(aux)+" "+str(desti)) os.system(tryhard)

Aucun commentaire:

Enregistrer un commentaire