I am trying to write a script in python which could allow me to move zip files to a new folder based on their names, but I am struggling with it as I cannot figure out how to make python read the zip files name and move it to relevant folders. Any help would be appreciated.
zip file names are 12345788_CATPICC1_2022_01_10_08_21_31.zip 90234578_CATPICC1_2022_01_10_08_21_31.zip 96352536_CATPICC2_2022_01_10_08_21_31.zip 78541296_CATPICC2_2022_01_10_08_21_31.zip
Folders where above zip files need to go: Markky wool (CATPICC1) Markky wool (CATPICC2)
when moving zip file python needs to read CATPICC1 from 12345788_CATPICC1_2022_01_10_08_21_31.zip and move it to Markky wool (CATPICC1) and if zip file name is 78541296_CATPICC2_2022_01_10_08_21_31.zip then move it to Markky wool (CATPICC2)
i have thousands of files like these and i want to move each of them to a folder with matching name e.g., 12345788_CATPICC1_2022_01_10_08_21_31.zip to Markky wool (CATPICC1)
Try this, accounting for your own OS and filepaths: