Created
          April 9, 2020 15:27 
        
      - 
      
- 
        Save hovedguy/263fa40318cca08380d63ce59d72b04e to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ''' | |
| 04-09-2020, rev.01 | |
| Copy files of particular extension from a directory (nested directories as well) to new directory | |
| ''' | |
| import glob | |
| import shutil | |
| main_dir = r'D:\Machine Learning\_Udemy - Complete Tensorflow 2 and Keras Deep Learning Bootcamp' | |
| target_dir = r'C:\Users\suvop\Desktop\target_dir' | |
| files = glob.glob(main_dir + r'\**\*.mp4', recursive=True) | |
| for file in files: | |
| shutil.copy(file, target_dir) | |
| print(f'Number of files copied: {len(files)}') | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment