Skip to content

Instantly share code, notes, and snippets.

Working from home

Mahmood Hussain Bhat Mahmood-Hussain

Working from home
View GitHub Profile
Mahmood-Hussain /
Last active Sep 1, 2022
Move or Copy files form source directory to destination directory with progress using python
import glob
import os
import argparse
parser = argparse.ArgumentParser(description='Copy or move files')
parser.add_argument('--source', help='Source directory', type=str)
parser.add_argument('--dest', help='Destination directory', type=str)
parser.add_argument('-r', '--recursive', action='store_true', help='Recursive if you want to scan sub directories recursively', default=True)
parser.add_argument('-e', '--extensions', nargs='+', help='Extensions allowed', default=['jpg', 'png', 'gif'])
parser.add_argument('-c', '--copy', action='store_true', help='Copy files or move files default is copy files', default=True)