#!/usr/bin/env python # coding: utf-8 # In[1]: import shutil import glob import os # In[2]: def move_glob(dst_path, pathname, recursive=True): for p in glob.glob(pathname, recursive=recursive): shutil.move(p, dst_path) # In[3]: os.mkdir('temp/dir2') # In[4]: move_glob('temp/dir2', 'temp/**/*.txt')