I made a horrible error in a very long-running computation.
One part of the computation stores result files in a directory structure like so:
path/to/first/[A,B,C,D]/[1,2,3,4,5]/outfiles
And another does it like this:
path/to/second/[1,2,3,4,5]/[A,B,C,D]/outfiles
That is, when part 1 of the script stores files, it creates a directory for, say, A, then stores iterations 1,2,3,4, and 5 as subdirectories. When part 2 does its computations, it creates a directory for iteration 1, and then stores the first iteration of computations A,B,C, and D in subdirectories.
I'd like to "invert" the second directory structure to be like the first, since rerunning the original script with the directory fix will take too long, and my post-processing code that should otherwise work for part 2 already handles part 1's structure.
That is, path/to/second/1/A
should become path/to/second/A/1
, containing the files that were previously 1/A
. Is there a simple way to achieve this?
To complicate matters with making temporary directories, while I used [A,B,C,D] and [1,2,3,4,5] in my example for clarity, the directories for both hierarchies are just numbers and definitely have name collisions (that is, things like 10/10
exist).