Hi Team,
I have 2000 csv files in a source folder. airtel,jio data files etc.
file naming convention start with mobile no and then string value concatenation.
I have list of 800 mobile phones , I have to search source folder if file contains any of these mobile no,
I want to move all files including duplicate files also.
below is attempted code , which is working , it should move duplicate files as well.
but its moving single file only.
I have 2000 csv files in a source folder. airtel,jio data files etc.
file naming convention start with mobile no and then string value concatenation.
I have list of 800 mobile phones , I have to search source folder if file contains any of these mobile no,
I want to move all files including duplicate files also.
below is attempted code , which is working , it should move duplicate files as well.
but its moving single file only.
import glob import os import shutil import csv SOURCE_PATH = r"E:\data\src" TARGET_PATH = r"E:\data\destination" with open(r'E:\data\mobile_list.csv','r') as f: reader = csv.reader(f) header = next(reader) for m in reader: for file in glob.glob(os.path.join(SOURCE_PATH, f'*{m}*')): shutil.move(file, TARGET_PATH) print("success")