While this blog is new, I want to ensure I keep content going lest it goes abandoned and six months from now I wonder what happened. Most of my original inspiration on putting content here is based on useful work I do. Not having anything interesting to share from current work, I’ll share a segment of things I find interesting and useful from time to time.

So this post is kicking off my category of “One Line Commands”. Over the years I have found myself finding, grepping, cutting and PERLing through directories and files to find some useful information to solve some issue. This first example is a PERL script that recurses through directory tree printing and adds indent based on the current level. Output can be sent to a file and imported into Excel. It is setup to ignore subversion files/directories because at the time I wanted to get a full directory tree from a checked out repository.

perl -e 'use File::Find; sub pl {my ($sc) = @_; print "\t" while ($sc--
> 0); } sub wanted { $f=$_; $fn=$File::Find::name; return if $fn =~ /.svn/; my
$sc=($fn =~tr/\///); if (-d $fn) {pl($sc); print "$f/\n";} else {pl($sc); print
"$f"; pl(20-$sc); print "$fn\n";}}; find(\&wanted, ("."));'

Copy and pastes into one command line entry.