Copy specific files with copy tree (Python)

401 Views Asked by At

I have this script:

import os, sys, shutil, glob
from distutils.dir_util import copy_tree

if not os.path.exists('Files'):
    os.makedirs('Files')

source_dir = os.path.join(os.environ["HOMEPATH"], "Desktop")
dest_dir = 'Files'

copy_tree(source_dir, dest_dir)

But I want to copy only a specific file (.txt), how can I do it?

Have a good day.

0

There are 0 best solutions below