I was programming in python and I got something that I cannot fix. I have this code:
import shutil
import pathlib
import os
zdroj =(r'C:\Users\Acer\Desktop\New')
cil =(r'C:\Users\Acer\Desktop\New2')
files = os.listdir(zdroj)
print(files)
print (files)
for f in files:
c = (r'\'' + f)
c = c.split("'")
shutil.move(str(zdroj) + c[0], str(cil))
But it move the folder too, anyone that can help me?
Try the following:
import shutil
import pathlib
import os
zdroj =(r'C:\Users\Acer\Desktop\New')
cil =(r'C:\Users\Acer\Desktop\New2')
files = os.listdir(zdroj)
print(files)
for f in files:
src = os.path.join(zdroj, f)
shutil.move(src, str(cil))