I am trying to organize files into specific folders by using fnmatch but for some reason the the files are not able to be moved or copied once they go through the loop I wrote. I made sure that every directory is correctly named and printed to check if my program is working which it does.
import os
import shutil
import fnmatch
from pathlib import Path
for dirpath, dirnames, files in os.walk('.'):
for file_name in files:
if fnmatch.fnmatch(file_name, "808"):
shutil.copy(file_name, ".")
FileNotFoundError: [Errno 2] No such file or directory: 'KSHMR_Trap_808_07_F.wav