\chapter{eio\+\_\+dir\+\_\+copy() tutorial}
\hypertarget{tutorial_dir_copy}{}\label{tutorial_dir_copy}\index{eio\_dir\_copy() tutorial@{eio\_dir\_copy() tutorial}}
To use \doxylink{group__Eio__Management_ga90b445aba3bc352cf5a094059be259bc}{eio\+\_\+dir\+\_\+copy()}, you basically need the source and destination files (or directories), and set three callbacks\+:

\begin{DoxyItemize}
\item The notification callback, which allows you to know if a file or a directory is copied, and the progress of the copy. \item The end callback, which is called when the copy is finished. \item The error callback, which is called if an error occurred. You can then retrieve the error type as an errno error.\end{DoxyItemize}
\begin{DoxyWarning}{Warning}
It is the user\textquotesingle{}s duty to provide the "{}right target"{}. It means that copying to \textquotesingle{}.\textquotesingle{} will copy the content directly inside \textquotesingle{}.\textquotesingle{} and not in a subdirectory.
\end{DoxyWarning}
Here is a simple example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Ecore.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Eio.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_test\_notify\_cb(\textcolor{keywordtype}{void}\ *data,\ Eio\_File\ *handler,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct__Eio__Progress}{Eio\_Progress}}\ *info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{switch}\ (info-\/>\mbox{\hyperlink{struct__Eio__Progress_ad22889d94364501b49e38f8ab76b681d}{op}})}
\DoxyCodeLine{\ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{Eio__Legacy_8h_af9cb2b88e673b8a3e6cb533fd1d90e4dab21f36fa998884ac4d36d9c114a88012}{EIO\_FILE\_COPY}}:}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}[\%s]\ \%f\%\%\(\backslash\)n"{}},\ info-\/>\mbox{\hyperlink{struct__Eio__Progress_a533f908b383c954f1a7e2b8545e36602}{dest}},\ info-\/>\mbox{\hyperlink{struct__Eio__Progress_a177cdb18d72bd8babab22b96b58ea6e2}{percent}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{Eio__Legacy_8h_af9cb2b88e673b8a3e6cb533fd1d90e4dad86557496ac7b04ab5b4fb648b7b2bcd}{EIO\_DIR\_COPY}}:}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}global\ [\%li/\%li]\ \%f\%\%\(\backslash\)n"{}},\ info-\/>\mbox{\hyperlink{struct__Eio__Progress_a1b57c27fa219d799e27ce2f2b0480832}{current}},\ info-\/>\mbox{\hyperlink{struct__Eio__Progress_a575992c43ccfdc0a189054095b2bfae5}{max}},\ info-\/>\mbox{\hyperlink{struct__Eio__Progress_a177cdb18d72bd8babab22b96b58ea6e2}{percent}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{\ \ \ \ \ \ \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_test\_done\_cb(\textcolor{keywordtype}{void}\ *data,\ Eio\_File\ *handler)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}copy\ done\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_test\_error\_cb(\textcolor{keywordtype}{int}\ error,\ Eio\_File\ *handler,\ \textcolor{keywordtype}{void}\ *data)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}error:\ [\%s]\(\backslash\)n"{}},\ strerror(error));}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}\ **argv)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Eio\_File\ *cp;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (argc\ !=\ 3)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}eio\_cp\ source\_file\ destination\_file\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eio__Helper_ga557c198fc1a90518d7872b77843fa029}{eio\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ cp\ =\ \mbox{\hyperlink{group__Eio__Management_ga90b445aba3bc352cf5a094059be259bc}{eio\_dir\_copy}}(argv[1],\ argv[2],}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_test\_notify\_cb,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_test\_done\_cb,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_test\_error\_cb,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eio__Helper_ga7c3ad77c3f9a0346aab50f474af54b6c}{eio\_shutdown}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}

\end{DoxyCode}
 