So I have a bunch of folders in the format of: .../course/year/...
and I often reorganize them so that the format then changes to this: .../year/course/...
. I've been meaning to learn how to write shell scripts and I'm very new to automation and shell scripting but I want to make a script that does this for me when I input a path to the folder that I want renamed. So for example I would have a command like: sh reorganize.sh .../course/year/...
and it would "swap" the course folder and the year folder. The year folder has some contents inside and after the swap everything that was in the year folder should now be in the course folder. There are also multiple year folders, so 2018, 2019, 2020 each have their own folder inside the course folder. I appreciate any help with how I can go about doing this.
PS- When I say I'm fairly new, what I mean is that I know the basic behind variables and pipes and basic commands but don't have much knowledge otherwise.
../$course/$year/
to../$course/$course
and then to../$year/$course
. You can do it with twomv
commands$course/$year
...