tree -f でいいじゃんという話。
$ tree test | awk 'NF{depth=gsub("[│├└]","&",$0); if(last_depth < depth){dirs[depth]=last_dir;}else if(last_depth > depth){dirs[last_depth]="";} last_dir=$NF;last_depth=depth;pdir=".";for (i in dirs){pdir=pdir"/"dirs[i];} gsub("/$","",pdir);$NF=pdir"/"$NF;print}' | sed '$d'Preparation
$ mkdir test/{aaa,bbb}
$ touch test/aaa/{aaa1,aaa2,aaa3}
$ touch test/bbb/{bbb1,bbb2}
$ touch test/{root1,root2}$ tree test/
test/
├── aaa
│ ├── aaa1
│ ├── aaa2
│ └── aaa3
├── bbb
│ ├── bbb1
│ └── bbb2
├── root1
└── root2
2 directories, 7 files$ tree test | awk 'NF{depth=gsub("[│├└]","&",$0); if(last_depth < depth){dirs[depth]=last_dir;}else if(last_depth > depth){dirs[last_depth]="";} last_dir=$NF;last_depth=depth;pdir=".";for (i in dirs){pdir=pdir"/"dirs[i];} gsub("/$","",pdir);$NF=pdir"/"$NF;print}' | sed '$d'
./test
├── ./test/aaa
│ ├── ./test/aaa/aaa1
│ ├── ./test/aaa/aaa2
│ └── ./test/aaa/aaa3
├── ./test/bbb
│ ├── ./test/bbb/bbb1
│ └── ./test/bbb/bbb2
├── ./test/root1
└── ./test/root2