I am learning python (python 3) and I can copy 1 file to a new directory by doing this
import shutil
shutil.copyfile('C:/test/test.txt', 'C:/lol/test.txt')
What I am now trying to do is to copy all *.txt files from C:/ to C:/test
*.txt is a wildcard to search for all the text files on my hard drive
I am using python 2.7 test first to make sure it will work. I used the wildcard * because I add the date to all my text files. filename1_2016_04_18.txt Also some of the text files have different end users attached to the text file. filename2_username.txt
Use
glob.glob()
to get a list of the matching filenames and then iterate over the list.