How to compress multiple folders into multiple zip files My folder structure is:
YEAR - MONTH - DAY - SUBFOLDERS
I want to compress each subfolder in the [DAY] directories. The solution from  here which is:
for i in */; do zip -r &quot;${i%/}.zip&quot; &quot;$i&quot;; done

works fine as long as I'm doing it from a [DAY] folder. But if I change it to:
for i in */*/; do zip -r &quot;${i%/}.zip&quot; &quot;$i&quot;; done

and run from a [MONTH] folder it still works, but the problem is that the .zip now contains an additional parent folder for each additional '/*' in the command when I unpack.
How can I run the command from a [YEAR] folder with '/* /* /*' while making sure that the .zip only contains the lowest level subfolder when I unpack?
In your case you can combine two loops to accomplish this
cd YEAR
for month in */; do
    (cd &quot;$month&quot;;  for i in */; do zip -r &quot;${i%/}.zip&quot; &quot;$i&quot;; done)
done

PS: If MONTH folders can be empty you need to check for this in the inner loop.