filter for tree command.
can indent directories and files without using indentation line.
for linux ( filter.sh ) and windows ( filter.ps1 ).
- jq
 - python3.x
 
tree [${TARGET_DIRECTORY}] -J | ./filter.shtree command only
$ tree ./directory0
./directory0
├── directory1
│   ├── directory2
│   │   ├── directory3
│   │   └── file3
│   └── file2
└── file1tree commnad with filter
$ tree ./directory0 -J | ./filter.sh
./directory0/
        directory1/
                directory2/
                        directory3/
                        file3
                file2
        file1
$- Windows Powershell
 
create filter (see filter.ps1.)
PS C:\test> filter IndentFilter {
% { $_ -replace "^(.*[+,\\\\]-.*)$","$&\" } |
% { $_ -replace "\|   " ,"`t" }  |
% { $_ -replace "\+---" ,"`t" }  |
% { $_ -replace "\\---" ,"`t" }  |
% { $_ -replace "    "  ,"`t" }  |
% { If ( $_ -notmatch "`t+$" ){$_} }
}use filter
tree /F /A [TARGET_DIRECTORY] | IndentFiltertree command only
PS C:\test> tree .\directory0 /F /A
C:\TEST\DIRECTORY0
|   file1
|
\---directory1
    |   file2
    |
    \---directory2
        |   file3
        |
        \---directory3
PS C:\test>tree commnad with filter
PS C:\test> tree .\directory0 /F /A | IndentFilter
C:\TEST\DIRECTORY0
        file1
        directory1\
                file2
                directory2\
                        file3
                        directory3\
PS C:\test>