better note for whiteboard cleanup, had to use process today.
[feisty_meow.git] / scripts / files / zip_directories.sh
index 1b5e5d014a592dc4b6519fdafc6fda67a5c0fad4..c3aee86046861d19cd2e1f84d993ffaa84a15ae5 100644 (file)
@@ -5,7 +5,18 @@
 
 source $FEISTY_MEOW_SCRIPTS/core/functions.sh
 
-#hmmm: take a dir to go to for this.
+#hmmm: take a dir parameter to go to for this.
 dir=.
 
-for i in $(find $dir -mindepth 1 -maxdepth 1 -type d) ; do zip -rm "${i}_$(date_stringer)" "$i"; done
+function flattenizer()
+{
+  while read dirname; do
+    if [ ! -z "$dirname" ]; then
+      echo "flattening directory '$dirname'..."
+      zip -rm "${dirname}_$(date_stringer)" "$dirname" &>/dev/null
+    fi
+  done
+}
+
+find $dir -mindepth 1 -maxdepth 1 -type d | flattenizer
+