PoshCode Archive  Hex Artifact Content

Artifact 020401fc36ce2f05e3fd160d8e6c76f09c1fac2bf8259284009a0844bc61ef3e:

  • File directories-tree.ps1 — part of check-in [961b0e96f8] at 2018-06-10 13:43:00 on branch trunk — If ‘tree’ pocket has not been installed that you can use next script but note that it gets only directories. (user: greg zakharov size: 487)

0000: 23 20 65 6e 63 6f 64 69 6e 67 3a 20 61 73 63 69  # encoding: asci
0010: 69 0d 0a 23 20 61 70 69 3a 20 62 61 73 68 0d 0a  i..# api: bash..
0020: 23 20 74 69 74 6c 65 3a 20 64 69 72 65 63 74 6f  # title: directo
0030: 72 69 65 73 20 74 72 65 65 0d 0a 23 20 64 65 73  ries tree..# des
0040: 63 72 69 70 74 69 6f 6e 3a 20 49 66 20 e2 80 98  cription: If ...
0050: 74 72 65 65 e2 80 99 20 70 6f 63 6b 65 74 20 68  tree... pocket h
0060: 61 73 20 6e 6f 74 20 62 65 65 6e 20 69 6e 73 74  as not been inst
0070: 61 6c 6c 65 64 20 74 68 61 74 20 79 6f 75 20 63  alled that you c
0080: 61 6e 20 75 73 65 20 6e 65 78 74 20 73 63 72 69  an use next scri
0090: 70 74 20 62 75 74 20 6e 6f 74 65 20 74 68 61 74  pt but note that
00a0: 20 69 74 20 67 65 74 73 20 6f 6e 6c 79 20 64 69   it gets only di
00b0: 72 65 63 74 6f 72 69 65 73 2e 0d 0a 23 20 76 65  rectories...# ve
00c0: 72 73 69 6f 6e 3a 20 30 2e 31 0d 0a 23 20 61 75  rsion: 0.1..# au
00d0: 74 68 6f 72 3a 20 67 72 65 67 20 7a 61 6b 68 61  thor: greg zakha
00e0: 72 6f 76 0d 0a 23 20 6c 69 63 65 6e 73 65 3a 20  rov..# license: 
00f0: 43 43 30 0d 0a 23 20 78 2d 70 6f 73 68 63 6f 64  CC0..# x-poshcod
0100: 65 2d 69 64 3a 20 34 35 36 31 0d 0a 23 20 78 2d  e-id: 4561..# x-
0110: 61 72 63 68 69 76 65 64 3a 20 32 30 31 33 2d 31  archived: 2013-1
0120: 31 2d 30 34 54 31 34 3a 33 33 3a 33 37 0d 0a 23  1-04T14:33:37..#
0130: 20 78 2d 70 75 62 6c 69 73 68 65 64 3a 20 32 30   x-published: 20
0140: 31 33 2d 31 30 2d 32 36 54 31 36 3a 33 39 3a 30  13-10-26T16:39:0
0150: 30 0d 0a 23 0d 0a 23 0d 0a 23 21 2f 62 69 6e 2f  0..#..#..#!/bin/
0160: 62 61 73 68 0d 0a 0d 0a 69 66 20 5b 20 2d 7a 20  bash....if [ -z 
0170: 22 24 31 22 20 5d 3b 20 74 68 65 6e 20 6c 6f 63  "$1" ]; then loc
0180: 3d 24 28 70 77 64 29 3b 20 65 6c 73 65 20 6c 6f  =$(pwd); else lo
0190: 63 3d 24 31 3b 20 66 69 0d 0a 6c 73 20 2d 61 52  c=$1; fi..ls -aR
01a0: 20 24 6c 6f 63 20 7c 20 67 72 65 70 20 27 3a 24   $loc | grep ':$
01b0: 27 20 7c 20 73 65 64 20 2d 65 20 27 73 2f 3a 24  ' | sed -e 's/:$
01c0: 2f 2f 3b 73 2f 5b 5e 2d 5d 5b 5e 5c 2f 5d 2a 5c  //;s/[^-][^\/]*\
01d0: 2f 2f 2d 2d 2f 67 3b 73 2f 5e 2f 20 2f 3b 73 2f  //--/g;s/^/ /;s/
01e0: 2d 2f 7c 2f 27 0d 0a                             -/|/'..