Output from tree command in a listing

The output of tree on your machine uses special UTF-8 characters , , to draw the lines. On the one hand, these characters are not available in the standard LaTeX fonts. On the other hand, listings itself is not capable to typeset multibyte characters.

To include the output "as is" in you LaTeX document, a simple solution would be to use listings literate option to transparently transform these characters into something that listings can typeset:

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{listings}
  \lstdefinestyle{ascii-tree}{
    literate={├}{|}1 {─}{--}1 {└}{+}1 
  }
\begin{document}
\begin{frame}[fragile]

\begin{lstlisting}[style=ascii-tree]
5053
├── 20141018105053_100_samples.bin
├── 20141018105053_101_samples.bin
├── 20141018105053_102_samples.bin
├── 20141018105053_105_samples.bin
└── out
    ├── 20141018105053_100_samples.bin.pps
    ├── 20141018105053_101_samples.bin.pps
    ├── 20141018105053_102_samples.bin.pps
    ├── 20141018105053_105_samples.bin.pps
    └── TOA_train.npy
\end{lstlisting}

\end{frame}     
\end{document}

enter image description here

This basically mimics the tree output on a terminal that does not feature UTF-8. However, you could substitute with whatever you want (even macros), so the output could be improved even further. In the following, I replace them by some (plain) line drawing commands:

  \lstdefinestyle{tree}{
    literate=
    {├}{{\smash{\raisebox{-1ex}{\rule{1pt}{\baselineskip}}}\raisebox{0.5ex}{\rule{1ex}{1pt}}}}1 
    {─}{{\raisebox{0.5ex}{\rule{1.5ex}{1pt}}}}1 
    {└}{{\smash{\raisebox{0.5ex}{\rule{1pt}{\dimexpr\baselineskip-1.5ex}}}\raisebox{0.5ex}{\rule{1ex}{1pt}}}}1 
  }
\begin{document}
\begin{frame}[fragile]

\begin{lstlisting}[style=tree]
5053
├── 20141018105053_100_samples.bin
├── 20141018105053_101_samples.bin
├── 20141018105053_102_samples.bin
├── 20141018105053_105_samples.bin
└── out
    ├── 20141018105053_100_samples.bin.pps
    ├── 20141018105053_101_samples.bin.pps
    ├── 20141018105053_102_samples.bin.pps
    ├── 20141018105053_105_samples.bin.pps
    └── TOA_train.npy
\end{lstlisting}

\end{frame}     

Which results in:

enter image description here


May be you should use dirtree package:

   \documentclass[10pt,a4paper,compress,svgnames]{beamer}
   \usepackage{dirtree}
    \begin{document}
    \begin{frame}
        \dirtree{%
        .1 5053 .
        .2 20141018105053\_100\_samples.bin.
        .2 20141018105053\_101\_samples.bin.
        .2 20141018105053\_102\_samples.bin.
        .2 20141018105053\_105\_samples.bin.
        .2 out .
            .3 20141018105053\_100\_samples.bin.pps.
            .3 20141018105053\_101\_samples.bin.pps.
            .3 20141018105053\_102\_samples.bin.pps.
            .3 20141018105053\_105\_samples.bin.pps.
            .3 TOA\_train.npy.
        }
    \end{frame}
    \end{document}

The package does not seem to be included in mainstream Latex distribution but it can be downloaded from CTAN here. enter image description here