I am a marker and I have a whole lot of coursework files given to me in a folder with a structure like this:
student number --> coursework1 --> coursework.thy
Each student has one folder named student number which contains a single subfolder coursework1, and that subfolder contains a single file with extension .thy. Annoyingly, the files all have the same name coursework.thy Now, I want to name all the files after the student number of the student. In other words, I want to name the files not after the folder that contains them, but after the folder that contains the folder that contains them. I want to keep the original file extension.
Ultimately I would like to put all of these named files in a single folder (without subfolders) but I found a question answering that part of my issue: How do I move files out of nested subdirectories into another folder in ubuntu? (Trying to strip off many subfolders).
I want to do this using the terminal/bash ideally.