Archive for August, 2009
rsync
Thursday, August 13th, 2009Note that doubling a single-quote inside a single-quoted string gives you a single-quote; likewise for double-quotes (though you need to pay attention to which quotes your shell is parsing and which quotes rsync is parsing).
Ow, my head hurts.
Directory tree
Monday, August 10th, 2009A handy Bash script to display a tree view of a directory, adapted from http://www.centerkey.com/tree. This version omits .svn and .git directories, and uses the find utility.
echo if [ "$1" != "" ] #if parameter exists, use as base folder then cd "$1" fi pwd find . \! \( -path "*.svn*" -or -path "*.git*" \) -type d | \ sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' if [ `ls -F -1 | grep "/" | wc -l` = 0 ] then echo " -> no sub-directories" fi echo exit
Example use:
[cgansen@Crystal-Frontier ~]$ tree projects/self.d-struct.org/wp-admin/ /Users/cgansen/projects/self.d-struct.org/wp-admin . |-css |-images |-import |-includes |-js [cgansen@Crystal-Frontier ~]$