learning *nix : find #1

This entry is part 1 of 1 in the series learning *nix

Compressing a bunch of folders that contain image sequences.

The other day I used the find command ( which I’ve come to love, since I started using it ) with 7z to compress a bunch of folders that contained image sequences in separate zip files to share with a client.
While on the folder that contained my image sequence folders, I used:

find . -depth 1 -type d -exec 7z a "{}.zip" "{}" ;\\

It worked pretty neatly.

find . just executes the command in “.” ( the curent folder ), -depth 1 restricts the search to the current folder and no deeper into the folder structure.
-type d restricts the search to just directories, and -exec 7z a "{}.zip "{}" ;\\ executes 7z adding “FoundFolderX” to the zip file called “FoundFolderX.zip”

So in the end you get as many zip files as folders there were in your folder structure.

Ready to send to client.