I just had occasion to type this and thought I'd share (fairly sure someone will have done this before, but my search-fu fails me).
Result:ls -R | perl -ne 'if(/:$/){s/:$//;s/[^\/]*\//--/g;s/^-/\t|/;print}'
$ ls -R | perl -ne 'if(/:$/){s/:$//;s/[^\/]*\//--/g;s/^-/\t|/;print}' |---branches |---hooks |---info |---logs |-----refs |-------heads |-------remotes |---------origin |---objects |-----02 |-----0a |-----10 |-----24 |-----27 |-----3f |-----41 |-----4e |-----64 |-----69 |-----6e |-----70 |-----74 |-----76 |-----7b |-----82 |-----8d |-----94 |-----a7 |-----ac |-----b0 |-----b7 |-----d6 |-----dd |-----e2 |-----info |-----pack |---refs |-----heads |-----remotes |-------origin |-----tags |-Spider |---Muffet |-----Filter |-------Reader |-----Output |-------Writer
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: One liner to print a file system tree on UNIX like systems
by toolic (Bishop) on Aug 21, 2013 at 13:35 UTC | |
Re: One liner to print a file system tree on UNIX like systems
by goldenblue (Acolyte) on Oct 02, 2013 at 19:17 UTC |
Back to
Cool Uses for Perl