Here's what I would like to achieve: I have some directories, and subdirectories in them (which may have sub-subdirectories). In each subdirectory I want a zip file with contents of that particular directory.find nicely finds my subdirectories: find . -mindepth 2 -maxdepth 2 -type dbut I have a hard time completing the-exec zip ... \;Would you be able to help me with that? I tried many combinations, can't figure it out. :(For clarification, here's a tree. DIR1  FILE1|    FILE2  FILE3 FILE4 DIR2  DIR3   SUBDIR1    SUBFILE1    SUBSUBDIR1     SUBSUBFILE1     SUBSUBFILE2    SUBSUBDIR1        SUBSUBFILE3        SUBSUBFILE4   FILE4   FILE5   FILE6   Zip file named DIR3.zip with FILE4, FILE5, FILE6
Zip subdirectories based on find, -exec
find;zip
Using -execdir instead of -exec runs the command from the directory find is currently traversing, which makes this problem a little easier:find . -mindepth 2 -maxdepth 2 -type d -execdir zip -r {}.zip {} ';'Note that the string {} is interpreted by find as the current filename, and is relative when -execdir is used.