├── .SmartGitAuto ├── abc └── blank ├── main.py ├── requirements.txt └── xyz ├── input1.csv └── input2.csv /.SmartGitAuto: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /abc/blank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Abhijith14/CSVautomation/00a0750eced9a1d21bd1fe07eb38555546d41253/abc/blank -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import shutil 3 | from pathlib import Path 4 | 5 | def move_contains_file(name): 6 | spath = "xyz/" + name 7 | dpath = "abc/" + name 8 | 9 | print("The keyword - 'v2eTechnologies' was found in " + name) 10 | 11 | if Path(dpath).exists(): 12 | print(name + " file already exists in the directory abc!!!") 13 | else: 14 | shutil.move(spath, dpath) 15 | print("Copied "+name+" to abc !!!") 16 | 17 | try: 18 | dt1 = pd.read_csv("xyz/input1.csv") 19 | dt2 = pd.read_csv("xyz/input2.csv") 20 | except: 21 | print("Files are missing in the directory. Check xyz folder...") 22 | exit() 23 | 24 | for i in dt1.columns: 25 | if i == "v2eTechnologies": 26 | move_contains_file("input1.csv") 27 | for i in dt2.columns: 28 | if i == "v2eTechnologies": 29 | move_contains_file("input2.csv") -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy==1.19.2 2 | pandas==1.1.3 3 | python-dateutil==2.8.1 4 | pytz==2020.1 5 | six==1.15.0 6 | -------------------------------------------------------------------------------- /xyz/input1.csv: -------------------------------------------------------------------------------- 1 | abc,def ,test,v2eTechnologies,example,hello 2 | -------------------------------------------------------------------------------- /xyz/input2.csv: -------------------------------------------------------------------------------- 1 | abc,def ,test,example,hello 2 | --------------------------------------------------------------------------------