Development > Scripting and Bash

Make efficient photo directories



following on from the music A-Z tip.
I learned a new trick for creating the year folders from "The Linux Command Line" book.
To this I then added in months by number, and the A-Z as used for music tip, to create efficient photo directories.

Open your terminal using the icon in the panel, or by holding down Ctrl and Alt keys then pressing t, (Ctrl+Alt+t)

Change to Pictures folder

--- Code: ---cd Pictures
--- End code ---

Type in this code and press enter

--- Code: ---mkdir -p life-in-pics/{2002..2020}/{1..12}/{A..Z}
--- End code ---

Here it makes inside the main Pictures directory, a folder/directory named life-in-pics,  inside this it makes year folders 2002 thru 2020 (future proofing a bit), inside each year it makes month folders numbered as 1 thru 12, inside each month it makes folders A thru Z.
In total the 1 line of code creates 6176 folders in 1 command, forming an efficient structure for the pics.

You can change the, life-in-pics, folder to whatever name you prefer, and alter the years to how you prefer, the 1..12 and A..Z needs to remain the same for it to work in this way.

Additional examples -

If you were making for pics of someone named Bob, and someone named, Karin, it would be like so

--- Code: ---mkdir -p life-in-pics/Bob/{2002..2020}/{1..12}/{A..Z}
--- End code ---

--- Code: ---mkdir -p life-in-pics/Karin/{2002..2020}/{1..12}/{A..Z}
--- End code ---

Inside the, life-in-pics folder/directory, there would be graphically visible 2 folders Bob, and, Karin, inside each of these there will be their own structure by year, month and A-Z each month.

It can also be used for music, documents, videos, or a directory of your own making, just cd (change directory to where you prefer.

I hope it may help someone with organizing their pics, or files, and save you some time. :)


[0] Message Index

Go to full version