Bash script needed to zip all subdirs
Posted on 2003-12-11
In a dir, call it /home/fred, I have many subdirs, many with subdirs themselves.
I'd like a bash script that gets all the dir names in /home/fred, and zips them into zipfiles named after the directory itself with a ".zip" at the end.
Something like ls -D | xargs zip -r somehow_get_the_dir_name.zip dir_name would work from the command line but I can't figure out how to pass the dir names to the zip command, so I'm guessing that some scripting is called for here.