How to auto zip all folders in linux ?

Here is a simple command that will automatically find and zip any folder/directory to the same name in a directory recursively

example of folders under /opt/ :- 
logs
Apache_logs
Sendmail_logs
Qmail_logs

To :- 
logs
Apache_logs.zip
Sendmail_logs.zip
Qmail_logs.zip

Solution :-

cd to location let say :- 
[root@amitmaheshwari.in opt]# cd /opt

[root@amitmaheshwari.in opt]# ls -l
total 16
drwxr-xr-x 2 root root 4096 Aug  6 14:35 Apache_logs
drwxr-xr-x 2 root root 4096 Aug  6 14:35 logs
drwxr-xr-x 2 root root 4096 Aug  6 14:35 Qmail_logs
drwxr-xr-x 2 root root 4096 Aug  6 14:35 Sendmail_logs


[root@amitmaheshwari.in opt]# find . -maxdepth 1 -type d ! -name ".*" -exec bash -c 'zip -r "$0.zip" "$0"' {} \;

[root@amitmaheshwari.in opt]# ls -l
total 32
drwxr-xr-x 2 root root 4096 Aug  6 14:35 Apache_logs
-rw-r--r-- 1 root root  174 Aug  6 14:36 Apache_logs.zip
drwxr-xr-x 2 root root 4096 Aug  6 14:35 logs
-rw-r--r-- 1 root root  160 Aug  6 14:36 logs.zip
drwxr-xr-x 2 root root 4096 Aug  6 14:35 Qmail_logs
-rw-r--r-- 1 root root  172 Aug  6 14:36 Qmail_logs.zip
drwxr-xr-x 2 root root 4096 Aug  6 14:35 Sendmail_logs
-rw-r--r-- 1 root root  178 Aug  6 14:36 Sendmail_logs.zip