Current work server has images arranged in the following folder structure:
.
└── Plans
├── Area 1
│ ├── Location 12.jpg
│ ├── Location 34.jpg
│ └── Location 37.jpg
└── Area 2
├── Location 2.jpg
├── Location 43.jpg
└── Location 54.jpg
Step 1) I would like to create a new folder for each .jpg file, labelled the same as the .jpg file but without the file extension ("jpg"). This will be in the same directory as the .jpg file.
Step 2) Within the newly created folders I would like to create 2 new sub folders - "Sales" and "Workshop"
Step 3) Move the .jpg file within the "Workshop" sub folder.
Step 4) Append all the .jpg files with "- Workshop".
Final structure:
.
└── Plans
├── Area 1
│ ├── Location 12
│ │ ├── Sales
│ │ └── Workshop
│ │ └── Location 12 - Workshop.jpg
│ ├── Location 34
│ │ ├── Sales
│ │ └── Workshop
│ │ └── Location 34 - Workshop.jpg
│ └── Location 37
│ ├── Sales
│ └── Workshop
│ └── Location 37 - Workshop.jpg
└── Area 2
├── Location 2
│ ├── Sales
│ └── Workshop
│ └── Location 2 - Workshop.jpg
├── Location 43
│ ├── Sales
│ └── Workshop
│ └── Location 43 - Workshop.jpg
└── Location 54
├── Sales
└── Workshop
└── Location 54 - Workshop.jpg
My attempt so far... For step 4 I've managed to conjure this command from researching.
find . -name "*.jpg" -exec rename -v 's/.jpg/ - Workshop.jpg/' {} \+
However, I'm struggling to create folders and subfolders in the correct structure using the find command.
while
loop, here is a rough (and incredibly ugly, but reliably working) example: https://askubuntu.com/a/1306737/1157519 – Levente Feb 10 '21 at 18:36