I have a directory tree where the path elements correspond to specific properties of the file at a particular path. For example, something like this:
$ tree
. ─ a ─ 1 ─ y ─ 334f
│ │ └── z ─ 6410
│ └── 2 ─ y ─ e776
└── b ─ 1 ─ y ─ 9828
└── 2 ─ y ─ 0149
└── z ─ 563a
I want to change the order of the path elements to put the (x|y) part first, then (1|2), then (a|b). (For example, ./a/1/y/334f should become ./y/1/a/334f.)
The complete final tree should be:
$ tree
. ─ y ─ 1 ─ a ─ 334f
│ │ └── b ─ 9828
│ └── 2 ─ a ─ e776
│ └── b ─ 0149
└── z ─ 1 ─ a ─ 6410
└── 2 ─ b ─ 563a
How do I do this?