import glob
import shutil
dest_dir = "C:/test"
for file in glob.glob(r'C:/*.txt'):
print(file)
shutil.copy(file, dest_dir)
Use glob.glob()
to get a list of the matching filenames and then iterate over the list.
import glob
import shutil
dest_dir = "C:/test"
for file in glob.glob(r'C:/*.txt'):
print(file)
shutil.copy(file, dest_dir)
Use glob.glob()
to get a list of the matching filenames and then iterate over the list.