The current file organization looks like this:
Species_name1.asc
Species_name1.csv
Species_name1_Averages.csv
...
...
Species_name2.asc
Species_name2.csv
Species_name2_Averages.csv
I need to figure out a script that can create the new directories with the names (Species_name1, Species_name2... etc) and that can move the files from the base directory into the appropriate new directories.
import os
import glob
import shutil
base_directory = [CURRENT_WORKING_DIRECTORY]
with open("folder_names.txt", "r") as new_folders:
for i in new_folders:
os.mkdirs(base_directory+i)
Above is an example of what I can think of doing when creating new directories within the base directory.
I understand that I will have to utilize tools within the os, shutil, and/or glob modules if I were to use python. However, the exact script is escaping me and my files remain unorganized. If there is any advise you can provide in helping me complete this small task I will be most grateful.
Also there are many file types and suffixes within this directory but the (species_name?) portion is always consistent.
Below is the expected hierarchy:
Species_name1
-- Species_name1.asc
-- Species_name1.csv
-- Species_name1_Averages.csv
Species_name2
-- Species_name2.asc
-- Species_name2.csv
-- Species_name2_Averages.csv
Thank you in advance!