diff .bashrc @ 101:8b15a38ccd0f

* fix vpns * create a flatten function
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 28 Oct 2010 13:05:56 -0700
parents 6d09c2a8e5e9
children 35d28c0a6ba3
line wrap: on
line diff
--- a/.bashrc	Mon Oct 25 08:18:00 2010 -0700
+++ b/.bashrc	Thu Oct 28 13:05:56 2010 -0700
@@ -290,6 +290,28 @@
 echo "default-push = ssh://${ROOT#http*://}"
 }
 
+flatten() {
+  directory=$PWD
+  if [ "$#" == "1" ]
+  then
+      directory=$1
+  fi
+  cd $directory
+  unset find # don't use the alias
+  find -name '*' -type f | sed 's/.\///' | while read line
+  do
+      filename=$(echo $line | sed 's/\//-/g')
+      mv "${line}" "${filename}"
+  done
+  for i in *
+  do
+      if [ -d $i ]
+      then
+          rm -rf "${i}"
+      fi
+  done
+}
+
 ### include overrides for commands
 source ~/.bash_overrides