I'm trying to figure out how to automate a way to create a sub folders for these example files and somehow trim it to the last word in the filename.
Input:
- E:\character\bob.png
- E:\character\bob_arms_crossed.png
- E:\character\bob_arms_cover_eyes.png
- E:\character\bob_body_sitting.png
- E:\character\bob_face_frown.png
- E:\character\bob_happy.png
Ideal output:
- E:\character\bob.png
- E:\character\bob\arms\crossed.png
- E:\character\bob\arms\cover\eyes.png
- E:\character\bob\body\sitting.png
- E:\character\bob\face\frown.png
- E:\character\bob\happy.png
I'm still new to coding and any help would be appreciated.
I found this script: https://stackoverflow.com/a/28921735/13500455.
It's really close to what I need, but it does nest any folders or trim the filename to the last word before the extension.
(p.s I did modify it at the top to accommodate .png)
I am familiar with mkdir folder1\folder2\folder3, to setup a folder structure manually. There has to be a way to use variables to hook each word in the file name to make a matching sub folder tree.