Не могу переместить файлы в папку
Хочу все файлы с расширением .png переместить в папку MyFile, но выдает ошибку Invalid argument.
import os
import shutil
os.mkdir(r"C:\Users\User\Desktop\MyFile")
name= "png"
for file in os.walk(r"C:\Users\User\Desktop"):
if name in os.path.basename(r"C:\Users\User\Desktop\{0}".format(file)):
shutil.move(r"C:\Users\User\Desktop\{0}".format(file),r"C:\Users\User\Desktop\MyFile")