#!perl -wp # # Turn a BBEdit directory listing into something more closely resembling # `find -print` -- the relative path is included on every line of output, # instead of nesting with tabs. # # Released under the Perl Artistic License # by Benjamin Elijah Griffin <*@qz.to> use strict; # Since we are in -p mode, initalize variables here BEGIN{$::dir='';} ($::scrap) = m/^(\t*)/; $::tabshere = $::scrap =~ tr/\t/\t/; $::dirdepth = $::dir =~ tr/:/:/; if ($::dirdepth > $::tabshere) { $::dir =~ s/(.+:|^)[^:]+:$/$1/; } s/^\t+/$::dir/; $::dir = $_ if m/:$/; chomp($::dir)