\hypertarget{class_qore_1_1_dir}{}\doxysection{Qore\+::Dir Class Reference} \label{class_qore_1_1_dir}\index{Qore::Dir@{Qore::Dir}} This class implements directory handling, file listing, creating/removing subdirectories, etc. \doxysubsection*{Public Member Functions} \begin{DoxyCompactItemize} \item bool \mbox{\hyperlink{class_qore_1_1_dir_a636f28d93d03ba82553b53d57c8c6978}{chdir}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_dir_ab732cb0fca5e4d8f297bd70f1f5c141d}{path}}) \begin{DoxyCompactList}\small\item\em Changes the current directory of the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object to the path given. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_dir_a2d7d2c165f79c44a32e3070bf72ab738}{chgrp}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} gid) \begin{DoxyCompactList}\small\item\em Change the group membership of the directory from the group id. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_dir_ac74826b6a80ff676c416cd3952f19cf0}{chgrp}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} groupname) \begin{DoxyCompactList}\small\item\em Change the group membership of the directory. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_dir_abe1d5f94d8397ed73190c724dbddfc6a}{chmod}} (softint mode) \begin{DoxyCompactList}\small\item\em Changes the mode of the directory. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_dir_a988c79eaccbcce08aa6c01f1484be269}{chown}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} uid) \begin{DoxyCompactList}\small\item\em Change the ownership of the directory from the userid. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_dir_a0e2c563864f858fba878a06f7500e3c8}{chown}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} username) \begin{DoxyCompactList}\small\item\em Change the ownership of the directory from the username. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_dir_a860319e60133b9a45b4c342810c3b228}{constructor}} (\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding) \begin{DoxyCompactList}\small\item\em Creates the Directory object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_dir_aed446bcffd8d04f98811513ef3f430f0}{copy}} () \begin{DoxyCompactList}\small\item\em Creates a new directory object with the same character encoding specification and the same path as the original. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_dir_a9e9f05c88ac58cdbf027f8f4d8bcdc40}{create}} (softint mode=0777) \begin{DoxyCompactList}\small\item\em Creates the directory tree the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object points to, if it does not exist. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_dir_a668096fd0b362cf2882a4e7c50b41118}{exists}} () \begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the path in the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object points to a directory that already exists and is openable by the current user, \mbox{\hyperlink{basic_data_types_False}{False}} otherwise. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} $>$ \mbox{\hyperlink{class_qore_1_1_dir_a3fbdc5f90807213fac1beeb89b1a6c46}{hstat}} () \begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash of file status information for the current directory. \end{DoxyCompactList}\item list$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}} (bool full=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}) \begin{DoxyCompactList}\small\item\em Get all entries in this directory, except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories; if any errors occur an exception is thrown. \end{DoxyCompactList}\item list$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_dir_a6da273ee6c1595977117ca2bd70393c8}{list}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__string__functions_ga7804f63df9b181e0bacb465eb912feb9}{regex}}, softint regex\+\_\+options=0, softbool full=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}) \begin{DoxyCompactList}\small\item\em Gets all entries in the directory that match the given regular expression (except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories); if any errors occur an exception is thrown. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_dir_a1a6dbece21668632e58a397f125666fb}{list\+Dirs}} (bool full=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}) \begin{DoxyCompactList}\small\item\em Retrieves all subdirectory entries in this directory, except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories; if any errors occur an exception is thrown. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_dir_ad3acbb349b8588202007463a0d194840}{list\+Dirs}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__string__functions_ga7804f63df9b181e0bacb465eb912feb9}{regex}}, softint regex\+\_\+options=0, softbool full=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}) \begin{DoxyCompactList}\small\item\em Gets all subdirectory entries in the directory that match the given regular expression (except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories); if any errors occur an exception is thrown. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_dir_ad2cc933a6fb81cd16b6143ed5afcaaad}{list\+Files}} (bool full=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}) \begin{DoxyCompactList}\small\item\em Retrieves all files in this directory; if any errors occur an exception is thrown. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_dir_a66f0804fc0c21f221f137afdd5e097ac}{list\+Files}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__string__functions_ga7804f63df9b181e0bacb465eb912feb9}{regex}}, softint regex\+\_\+options=0, softbool full=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}) \begin{DoxyCompactList}\small\item\em Retrieves all files in the directory that match the given regular expression; if any errors occur an exception is thrown. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_dir_adfeb093180181e6f4df3dad56e0101d9}{mkdir}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} subdir, softint mode=0777) \begin{DoxyCompactList}\small\item\em Creates a direct subdirectory in the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object\textquotesingle{}s current path. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} \mbox{\hyperlink{class_qore_1_1_dir_a3f85f9096e3fcc143e738982e5594ac2}{open\+Dir}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} subdir, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding) \begin{DoxyCompactList}\small\item\em Get a \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object as an subdir entry of the current directory. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_file}{File}} \mbox{\hyperlink{class_qore_1_1_dir_a11575c0b4bc1d08c423af79b3be908d6}{open\+File}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} filename, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} flags=\mbox{\hyperlink{group__file__open__constants_ga1ab351549a0b39d1492dc0a48d199f64}{O\+\_\+\+RDONLY}}, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} mode=0666, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding) \begin{DoxyCompactList}\small\item\em Create and open a \mbox{\hyperlink{class_qore_1_1_file}{File}} object in the current directory of the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object. \end{DoxyCompactList}\item \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_dir_ab732cb0fca5e4d8f297bd70f1f5c141d}{path}} () \begin{DoxyCompactList}\small\item\em Returns the path of the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no path is set. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_dir_a39555d1901ed0f7d0084803291e2afac}{remove\+File}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} file) \begin{DoxyCompactList}\small\item\em Remove the file with the given name in the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object\textquotesingle{}s directory. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_dir_a3bccdd964feba716bd0fd16347db1bb2}{rmdir}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} subdir) \begin{DoxyCompactList}\small\item\em Removes a direct subdirectory from the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object\textquotesingle{}s current path. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat}} () \begin{DoxyCompactList}\small\item\em Returns a list of file status information for the current directory. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} $>$ \mbox{\hyperlink{class_qore_1_1_dir_a53181a09db1ea32f65bb6c6b50f4692d}{statvfs}} () \begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash for the current directory. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection{Detailed Description} This class implements directory handling, file listing, creating/removing subdirectories, etc. \begin{DoxyParagraph}{Restrictions\+:} \mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}} \end{DoxyParagraph} The Dir class allows Qore programs to list and manipulate directories. Directory objects can be created/opened with a specific character encoding. This means that any entry read from the directory will be tagged with the directory\textquotesingle{}s character encoding. If no character encoding is given the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} is assumed. \begin{DoxyNote}{Note} This class is not available with the \mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{PO\+\_\+\+NO\+\_\+\+FILESYSTEM}} parse option \end{DoxyNote} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{class_qore_1_1_dir_a636f28d93d03ba82553b53d57c8c6978}\label{class_qore_1_1_dir_a636f28d93d03ba82553b53d57c8c6978}} \index{Qore::Dir@{Qore::Dir}!chdir@{chdir}} \index{chdir@{chdir}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{chdir()}{chdir()}} {\footnotesize\ttfamily bool Qore\+::\+Dir\+::chdir (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path }\end{DoxyParamCaption})} Changes the current directory of the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object to the path given. If this method returns \mbox{\hyperlink{basic_data_types_False}{False}} then the directory can be created by calling \mbox{\hyperlink{class_qore_1_1_dir_a9e9f05c88ac58cdbf027f8f4d8bcdc40}{Dir\+::create()}} \begin{DoxyParams}{Parameters} {\em path} & The path can be either an absolute path (leading with \textquotesingle{}/\textquotesingle{}) or a directory relative to the actual path\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if the new path is openable as directory (see \mbox{\hyperlink{class_qore_1_1_dir_a668096fd0b362cf2882a4e7c50b41118}{Dir\+::exists()}}) \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{if} (!d.chdir(\textcolor{stringliteral}{"{}../doc"{}})) \{} \DoxyCodeLine{ d.create(0755);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyNote}{Note} calls to change to the current directory {\ttfamily \char`\"{}.\char`\"{}} have no effect \end{DoxyNote} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+CHDIR-\/\+ERROR} & cannot change to relative directory because no current directory is set \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a2d7d2c165f79c44a32e3070bf72ab738}\label{class_qore_1_1_dir_a2d7d2c165f79c44a32e3070bf72ab738}} \index{Qore::Dir@{Qore::Dir}!chgrp@{chgrp}} \index{chgrp@{chgrp}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{chgrp()}{chgrp()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::\+Dir\+::chgrp (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{gid }\end{DoxyParamCaption})} Change the group membership of the directory from the group id. \begin{DoxyParams}{Parameters} {\em gid} & the groupid of the user to change the directory to\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Platform Availability\+:} \mbox{\hyperlink{group__option__constants_gaac007b653cdc3acf169c9cc76ce4a928}{Qore\+::\+Option\+::\+HAVE\+\_\+\+UNIX\+\_\+\+FILEMGT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ dir.chgrp(gid);} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+CHOWN-\/\+ERROR} & cannot change directory owner; no directory is set \\ \hline {\em DIR-\/\+CHOWN-\/\+FAILURE} & error changing directory owner ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_ac74826b6a80ff676c416cd3952f19cf0}\label{class_qore_1_1_dir_ac74826b6a80ff676c416cd3952f19cf0}} \index{Qore::Dir@{Qore::Dir}!chgrp@{chgrp}} \index{chgrp@{chgrp}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{chgrp()}{chgrp()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily nothing Qore\+::\+Dir\+::chgrp (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{groupname }\end{DoxyParamCaption})} Change the group membership of the directory. \begin{DoxyParams}{Parameters} {\em groupname} & the group name of the group to change the directory to\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Platform Availability\+:} \mbox{\hyperlink{group__option__constants_gaac007b653cdc3acf169c9cc76ce4a928}{Qore\+::\+Option\+::\+HAVE\+\_\+\+UNIX\+\_\+\+FILEMGT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ dir.chgrp(groupname);} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+CHGRP-\/\+PARAMETER-\/\+ERROR} & no userid found for user \\ \hline {\em DIR-\/\+CHOWN-\/\+ERROR} & cannot change directory owner; no directory is set \\ \hline {\em DIR-\/\+CHOWN-\/\+FAILURE} & error changing directory owner ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_abe1d5f94d8397ed73190c724dbddfc6a}\label{class_qore_1_1_dir_abe1d5f94d8397ed73190c724dbddfc6a}} \index{Qore::Dir@{Qore::Dir}!chmod@{chmod}} \index{chmod@{chmod}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{chmod()}{chmod()}} {\footnotesize\ttfamily nothing Qore\+::\+Dir\+::chmod (\begin{DoxyParamCaption}\item[{softint}]{mode }\end{DoxyParamCaption})} Changes the mode of the directory. \begin{DoxyParams}{Parameters} {\em mode} & The mode of the directory\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ dir.chmod(0750);} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+CHMOD-\/\+ERROR} & cannot change directory\textquotesingle{}s mode; no directory is set \\ \hline {\em DIR-\/\+CHMOD-\/\+FAILURE} & error changing directory\textquotesingle{}s mode ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a988c79eaccbcce08aa6c01f1484be269}\label{class_qore_1_1_dir_a988c79eaccbcce08aa6c01f1484be269}} \index{Qore::Dir@{Qore::Dir}!chown@{chown}} \index{chown@{chown}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{chown()}{chown()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::\+Dir\+::chown (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{uid }\end{DoxyParamCaption})} Change the ownership of the directory from the userid. \begin{DoxyParams}{Parameters} {\em uid} & the userid of the user to change the directory to\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Platform Availability\+:} \mbox{\hyperlink{group__option__constants_gaac007b653cdc3acf169c9cc76ce4a928}{Qore\+::\+Option\+::\+HAVE\+\_\+\+UNIX\+\_\+\+FILEMGT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ dir.chown(uid);} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+CHOWN-\/\+ERROR} & cannot change directory owner; no directory is set \\ \hline {\em DIR-\/\+CHOWN-\/\+FAILURE} & error changing directory owner ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a0e2c563864f858fba878a06f7500e3c8}\label{class_qore_1_1_dir_a0e2c563864f858fba878a06f7500e3c8}} \index{Qore::Dir@{Qore::Dir}!chown@{chown}} \index{chown@{chown}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{chown()}{chown()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily nothing Qore\+::\+Dir\+::chown (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{username }\end{DoxyParamCaption})} Change the ownership of the directory from the username. \begin{DoxyParams}{Parameters} {\em username} & the username of the user to change the directory to\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Platform Availability\+:} \mbox{\hyperlink{group__option__constants_gaac007b653cdc3acf169c9cc76ce4a928}{Qore\+::\+Option\+::\+HAVE\+\_\+\+UNIX\+\_\+\+FILEMGT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ dir.chown(username);} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+CHOWN-\/\+PARAMETER-\/\+ERROR} & no userid found for user \\ \hline {\em DIR-\/\+CHOWN-\/\+ERROR} & cannot change directory owner; no directory is set \\ \hline {\em DIR-\/\+CHOWN-\/\+FAILURE} & error changing directory owner ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a860319e60133b9a45b4c342810c3b228}\label{class_qore_1_1_dir_a860319e60133b9a45b4c342810c3b228}} \index{Qore::Dir@{Qore::Dir}!constructor@{constructor}} \index{constructor@{constructor}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}} {\footnotesize\ttfamily Qore\+::\+Dir\+::constructor (\begin{DoxyParamCaption}\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})} Creates the Directory object. The object will point to the currect directory of the process \begin{DoxyParams}{Parameters} {\em encoding} & the name of the default character encoding for filenames retrieved; if this argument is not given, filename strings retrieved will be tagged with the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} of the process\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{Dir dir(\textcolor{stringliteral}{"{}utf-\/8"{}});} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_dir_aed446bcffd8d04f98811513ef3f430f0}\label{class_qore_1_1_dir_aed446bcffd8d04f98811513ef3f430f0}} \index{Qore::Dir@{Qore::Dir}!copy@{copy}} \index{copy@{copy}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{copy()}{copy()}} {\footnotesize\ttfamily Qore\+::\+Dir\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates a new directory object with the same character encoding specification and the same path as the original. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{Dir nd = dir.copy();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_dir_a9e9f05c88ac58cdbf027f8f4d8bcdc40}\label{class_qore_1_1_dir_a9e9f05c88ac58cdbf027f8f4d8bcdc40}} \index{Qore::Dir@{Qore::Dir}!create@{create}} \index{create@{create}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{create()}{create()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Dir\+::create (\begin{DoxyParamCaption}\item[{softint}]{mode = {\ttfamily 0777} }\end{DoxyParamCaption})} Creates the directory tree the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object points to, if it does not exist. \begin{DoxyParams}{Parameters} {\em mode} & The mode of the directory \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the number of directories actually created \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{if} (!d.exists()) \{} \DoxyCodeLine{ \textcolor{keywordflow}{try} \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}\%y: does not exist; creating...\(\backslash\)n"{}}, d.path());} \DoxyCodeLine{ cnt = d.create(0755);} \DoxyCodeLine{ \} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{ \}} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+CREATE-\/\+ERROR} & cannot create directory; no directory is set \\ \hline {\em DIR-\/\+CREATE-\/\+FAILURE} & error creating directory ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a668096fd0b362cf2882a4e7c50b41118}\label{class_qore_1_1_dir_a668096fd0b362cf2882a4e7c50b41118}} \index{Qore::Dir@{Qore::Dir}!exists@{exists}} \index{exists@{exists}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{exists()}{exists()}} {\footnotesize\ttfamily bool Qore\+::\+Dir\+::exists (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the path in the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object points to a directory that already exists and is openable by the current user, \mbox{\hyperlink{basic_data_types_False}{False}} otherwise. \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if the path in the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object points to a directory that already exists and is openable by the current user, \mbox{\hyperlink{basic_data_types_False}{False}} otherwise \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{if} (!d.exists())} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}\%y: does not exist or cannot be opened\(\backslash\)n"{}}, d.path());} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_dir_a3fbdc5f90807213fac1beeb89b1a6c46}\label{class_qore_1_1_dir_a3fbdc5f90807213fac1beeb89b1a6c46}} \index{Qore::Dir@{Qore::Dir}!hstat@{hstat}} \index{hstat@{hstat}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{hstat()}{hstat()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$\mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}}$>$ Qore\+::\+Dir\+::hstat (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash of file status information for the current directory. If any errors occur an exception will be thrown \begin{DoxyReturn}{Returns} a \mbox{\hyperlink{struct_qore_1_1_stat_info}{Stat\+Info}} hash giving information about the current directory \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ hash h = dir.hstat();} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+HSTAT-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+HSTAT-\/\+FAILURE} & error stat\textquotesingle{}ing directory ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}\label{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}} \index{Qore::Dir@{Qore::Dir}!list@{list}} \index{list@{list}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{list()}{list()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily list$<$auto$>$ Qore\+::\+Dir\+::list (\begin{DoxyParamCaption}\item[{bool}]{full = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})} Get all entries in this directory, except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories; if any errors occur an exception is thrown. This method uses {\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}}} system call internally to get detailed info about directory entries if the {\ttfamily full} parameter is \mbox{\hyperlink{basic_data_types_True}{True}}. If a \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}} call fails for an entry, the entry is skipped and information about it is not included in the returned list. \begin{DoxyParams}{Parameters} {\em full} & if \mbox{\hyperlink{basic_data_types_True}{True}} then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} a list of all entries in the directory (except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories); if {\itshape full} is \mbox{\hyperlink{basic_data_types_True}{True}}, then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ map \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}entry: \%s\(\backslash\)n"{}}, \$1), d.list();} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+READ-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+READ-\/\+FAILURE} & error reading directory ({\ttfamily arg} will be assigned to the errno value)\\ \hline \end{DoxyExceptions} \begin{DoxySince}{Since} Qore 0.\+8.\+8 added the {\itshape full} parameter \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_dir_a6da273ee6c1595977117ca2bd70393c8}\label{class_qore_1_1_dir_a6da273ee6c1595977117ca2bd70393c8}} \index{Qore::Dir@{Qore::Dir}!list@{list}} \index{list@{list}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{list()}{list()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily list$<$auto$>$ Qore\+::\+Dir\+::list (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{regex, }\item[{softint}]{regex\+\_\+options = {\ttfamily 0}, }\item[{softbool}]{full = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})} Gets all entries in the directory that match the given regular expression (except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories); if any errors occur an exception is thrown. This method uses {\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}}} system call internally to get info about directory entries. If a \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}} call fails for an entry, the entry is skipped and information about it is not included in the returned list. \begin{DoxyParams}{Parameters} {\em regex} & a regular expression string used to filter the arguments (note that this is not a glob, but rather a regular expression string) \\ \hline {\em regex\+\_\+options} & optional bitwise-\/or\textquotesingle{}ed \mbox{\hyperlink{group__regex__constants}{regex option constants}} \\ \hline {\em full} & if \mbox{\hyperlink{basic_data_types_True}{True}} then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} a list of all entries in the directory that match the given regular expression (except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories); if {\itshape full} is \mbox{\hyperlink{basic_data_types_True}{True}}, then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ foreach string e \textcolor{keywordflow}{in} (d.list(\textcolor{stringliteral}{"{}\(\backslash\)\(\backslash\).txt\$"{}})) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}entry: \%s\(\backslash\)n"{}});} \DoxyCodeLine{ \}} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+READ-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+READ-\/\+FAILURE} & error reading directory ({\ttfamily arg} will be assigned to the errno value) \\ \hline {\em REGEX-\/\+COMPILATION-\/\+ERROR} & error in regular expression \\ \hline {\em REGEX-\/\+OPTION-\/\+ERROR} & regex option argument contains invalid option bits\\ \hline \end{DoxyExceptions} \begin{DoxySince}{Since} Qore 0.\+8.\+8 added the {\itshape full} parameter \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_dir_a1a6dbece21668632e58a397f125666fb}\label{class_qore_1_1_dir_a1a6dbece21668632e58a397f125666fb}} \index{Qore::Dir@{Qore::Dir}!listDirs@{listDirs}} \index{listDirs@{listDirs}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{listDirs()}{listDirs()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$auto$>$ Qore\+::\+Dir\+::list\+Dirs (\begin{DoxyParamCaption}\item[{bool}]{full = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})} Retrieves all subdirectory entries in this directory, except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories; if any errors occur an exception is thrown. This method uses {\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}}} system call internally to get info about directory entries. If a \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}} call fails for an entry, the entry is skipped and information about it is not included in the returned list. \begin{DoxyParams}{Parameters} {\em full} & if \mbox{\hyperlink{basic_data_types_True}{True}} then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} a list of all subdirectory entries in this directory, except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories; if {\itshape full} is \mbox{\hyperlink{basic_data_types_True}{True}}, then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ foreach string e \textcolor{keywordflow}{in} (d.listDirs()) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}entry: \%s\(\backslash\)n"{}});} \DoxyCodeLine{ \}} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+READ-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+READ-\/\+FAILURE} & error reading directory ({\ttfamily arg} will be assigned to the errno value)\\ \hline \end{DoxyExceptions} \begin{DoxySince}{Since} Qore 0.\+8.\+8 added the {\itshape full} parameter \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_dir_ad3acbb349b8588202007463a0d194840}\label{class_qore_1_1_dir_ad3acbb349b8588202007463a0d194840}} \index{Qore::Dir@{Qore::Dir}!listDirs@{listDirs}} \index{listDirs@{listDirs}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{listDirs()}{listDirs()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$auto$>$ Qore\+::\+Dir\+::list\+Dirs (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{regex, }\item[{softint}]{regex\+\_\+options = {\ttfamily 0}, }\item[{softbool}]{full = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})} Gets all subdirectory entries in the directory that match the given regular expression (except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories); if any errors occur an exception is thrown. This method uses {\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}}} system call internally to get info about directory entries. If a \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}} call fails for an entry, the entry is skipped and information about it is not included in the returned list. \begin{DoxyParams}{Parameters} {\em regex} & a regular expression string used to filter the arguments (note that this is not a glob, but rather a regular expression string) \\ \hline {\em regex\+\_\+options} & optional bitwise-\/or\textquotesingle{}ed \mbox{\hyperlink{group__regex__constants}{regex option constants}} \\ \hline {\em full} & if \mbox{\hyperlink{basic_data_types_True}{True}} then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} a list of all subdirectory entries in the directory that match the given regular expression (except {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} directories); if {\itshape full} is \mbox{\hyperlink{basic_data_types_True}{True}}, then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ foreach string e \textcolor{keywordflow}{in} (d.listDirs(\textcolor{stringliteral}{"{}\string^pgsql-\/"{}})) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}entry: \%s\(\backslash\)n"{}});} \DoxyCodeLine{ \}} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+READ-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+READ-\/\+FAILURE} & error reading directory ({\ttfamily arg} will be assigned to the errno value) \\ \hline {\em REGEX-\/\+COMPILATION-\/\+ERROR} & error in regular expression \\ \hline {\em REGEX-\/\+OPTION-\/\+ERROR} & regex option argument contains invalid option bits\\ \hline \end{DoxyExceptions} \begin{DoxySince}{Since} Qore 0.\+8.\+8 added the {\itshape full} parameter \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_dir_ad2cc933a6fb81cd16b6143ed5afcaaad}\label{class_qore_1_1_dir_ad2cc933a6fb81cd16b6143ed5afcaaad}} \index{Qore::Dir@{Qore::Dir}!listFiles@{listFiles}} \index{listFiles@{listFiles}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{listFiles()}{listFiles()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$auto$>$ Qore\+::\+Dir\+::list\+Files (\begin{DoxyParamCaption}\item[{bool}]{full = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})} Retrieves all files in this directory; if any errors occur an exception is thrown. This method uses {\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}}} system call internally to get info about directory entries. If a \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}} call fails for a file, the file is skipped and information about this file is not included in the returned list. \begin{DoxyParams}{Parameters} {\em full} & if \mbox{\hyperlink{basic_data_types_True}{True}} then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} a list of all files in the current directory of the object; if {\itshape full} is \mbox{\hyperlink{basic_data_types_True}{True}}, then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ foreach string e \textcolor{keywordflow}{in} (d.listFiles()) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}entry: \%s\(\backslash\)n"{}});} \DoxyCodeLine{ \}} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+READ-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+READ-\/\+FAILURE} & error reading directory ({\ttfamily arg} will be assigned to the errno value)\\ \hline \end{DoxyExceptions} \begin{DoxySince}{Since} Qore 0.\+8.\+8 added the {\itshape full} parameter \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_dir_a66f0804fc0c21f221f137afdd5e097ac}\label{class_qore_1_1_dir_a66f0804fc0c21f221f137afdd5e097ac}} \index{Qore::Dir@{Qore::Dir}!listFiles@{listFiles}} \index{listFiles@{listFiles}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{listFiles()}{listFiles()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$auto$>$ Qore\+::\+Dir\+::list\+Files (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{regex, }\item[{softint}]{regex\+\_\+options = {\ttfamily 0}, }\item[{softbool}]{full = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}} }\end{DoxyParamCaption})} Retrieves all files in the directory that match the given regular expression; if any errors occur an exception is thrown. This method uses {\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}}} system call internally to get info about directory entries. If a \mbox{\hyperlink{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}{stat()}} call fails for a file, the file is skipped and information about this file is not included in the returned list. \begin{DoxyParams}{Parameters} {\em regex} & a regular expression string used to filter the arguments (note that this is not a glob, but rather a regular expression string) \\ \hline {\em regex\+\_\+options} & optional bitwise-\/or\textquotesingle{}ed \mbox{\hyperlink{group__regex__constants}{regex option constants}} \\ \hline {\em full} & if \mbox{\hyperlink{basic_data_types_True}{True}} then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} a list of all files in the directory that match the given regular expression; if {\itshape full} is \mbox{\hyperlink{basic_data_types_True}{True}}, then the return value is a list of \mbox{\hyperlink{struct_qore_1_1_dir_stat_info}{Dir\+Stat\+Info}} hashes, otherwise a simple list of string names is returned \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ foreach string e \textcolor{keywordflow}{in} (d.listFiles(\textcolor{stringliteral}{"{}\(\backslash\)\(\backslash\).txt\$"{}})) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}entry: \%s\(\backslash\)n"{}});} \DoxyCodeLine{ \}} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+READ-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+READ-\/\+FAILURE} & error reading directory ({\ttfamily arg} will be assigned to the errno value) \\ \hline {\em REGEX-\/\+COMPILATION-\/\+ERROR} & error in regular expression \\ \hline {\em REGEX-\/\+OPTION-\/\+ERROR} & regex option argument contains invalid option bits\\ \hline \end{DoxyExceptions} \begin{DoxySince}{Since} Qore 0.\+8.\+8 added the {\itshape full} parameter \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_dir_adfeb093180181e6f4df3dad56e0101d9}\label{class_qore_1_1_dir_adfeb093180181e6f4df3dad56e0101d9}} \index{Qore::Dir@{Qore::Dir}!mkdir@{mkdir}} \index{mkdir@{mkdir}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{mkdir()}{mkdir()}} {\footnotesize\ttfamily nothing Qore\+::\+Dir\+::mkdir (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{subdir, }\item[{softint}]{mode = {\ttfamily 0777} }\end{DoxyParamCaption})} Creates a direct subdirectory in the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object\textquotesingle{}s current path. \begin{DoxyParams}{Parameters} {\em subdir} & The subdirectory name to create; only direct subdirectories are allowed; directory separator characters are not allowed \\ \hline {\em mode} & The mode of the directory\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ dir.mkdir(\textcolor{stringliteral}{"{}subdir"{}}, 0750);} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+MKDIR-\/\+PARAMETER-\/\+ERROR} & only direct subdirectories are allowed \\ \hline {\em DIR-\/\+MKDIR-\/\+FAILURE} & error creating directory ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a3f85f9096e3fcc143e738982e5594ac2}\label{class_qore_1_1_dir_a3f85f9096e3fcc143e738982e5594ac2}} \index{Qore::Dir@{Qore::Dir}!openDir@{openDir}} \index{openDir@{openDir}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{openDir()}{openDir()}} {\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} Qore\+::\+Dir\+::open\+Dir (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{subdir, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})} Get a \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object as an subdir entry of the current directory. \begin{DoxyParams}{Parameters} {\em subdir} & The name of the subdirectory for the new \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object (which must be in the current directory of the current \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object; no path separator characters are allowed) \\ \hline {\em encoding} & The name of the default character encoding for the new \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object; if this argument is not given, the new \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object will be tagged with the character encoding of the current \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object created for the directory \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{Dir sd = d.openDir(\textcolor{stringliteral}{"{}mysubdir"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+OPENDIR-\/\+PARAMETER-\/\+ERROR} & only direct subdirectory names without path separators are allowed \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a11575c0b4bc1d08c423af79b3be908d6}\label{class_qore_1_1_dir_a11575c0b4bc1d08c423af79b3be908d6}} \index{Qore::Dir@{Qore::Dir}!openFile@{openFile}} \index{openFile@{openFile}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{openFile()}{openFile()}} {\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_file}{File}} Qore\+::\+Dir\+::open\+File (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{filename, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{flags = {\ttfamily \mbox{\hyperlink{group__file__open__constants_ga1ab351549a0b39d1492dc0a48d199f64}{O\+\_\+\+RDONLY}}}, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{mode = {\ttfamily 0666}, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})} Create and open a \mbox{\hyperlink{class_qore_1_1_file}{File}} object in the current directory of the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object. This method uses the \mbox{\hyperlink{class_qore_1_1_file_acb397de36027a83129823742ac97c157}{File\+::open2()}} method to open the file. \begin{DoxyParams}{Parameters} {\em filename} & The filename for the file which must be in the current directory (no path separator characters are allowed) \\ \hline {\em flags} & Flags that determine the way the file is accessed, see \mbox{\hyperlink{group__file__open__constants}{File Open Constants}} for more information \\ \hline {\em mode} & Permission bits for when the file is to be created \\ \hline {\em encoding} & The name of the default character encoding for this file; if this argument is not given, the file will be tagged with the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} for the process\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{comment}{\# open a file for writing in the directory and set the mode to 0644 and the encoding to UTF-\/8}} \DoxyCodeLine{File f = d.openFile(\textcolor{stringliteral}{"{}myfile.txt"{}}, O\_CREAT|O\_WRONLY, 0644, \textcolor{stringliteral}{"{}utf-\/8"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+OPENFILE-\/\+PARAMETER-\/\+ERROR} & only direct subdirectory names without path separators are allowed\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} see \mbox{\hyperlink{class_qore_1_1_file_acb397de36027a83129823742ac97c157}{File\+::open2()}} for additional exceptions that can be thrown opening the file \end{DoxyNote} \mbox{\Hypertarget{class_qore_1_1_dir_ab732cb0fca5e4d8f297bd70f1f5c141d}\label{class_qore_1_1_dir_ab732cb0fca5e4d8f297bd70f1f5c141d}} \index{Qore::Dir@{Qore::Dir}!path@{path}} \index{path@{path}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{path()}{path()}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Dir\+::path (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the path of the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no path is set. This path does not necessarily need to exist; the path is adjusted to remove {\ttfamily \char`\"{}.\char`\"{}} and {\ttfamily \char`\"{}..\char`\"{}} from the path if present \begin{DoxyReturn}{Returns} the path of the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no path is set \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string mypath = d.path();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_dir_a39555d1901ed0f7d0084803291e2afac}\label{class_qore_1_1_dir_a39555d1901ed0f7d0084803291e2afac}} \index{Qore::Dir@{Qore::Dir}!removeFile@{removeFile}} \index{removeFile@{removeFile}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{removeFile()}{removeFile()}} {\footnotesize\ttfamily bool Qore\+::\+Dir\+::remove\+File (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{file }\end{DoxyParamCaption})} Remove the file with the given name in the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object\textquotesingle{}s directory. If any errors occur unlinking the file, then an exception occurs \begin{DoxyParams}{Parameters} {\em file} & Remove the file with the given name in the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object\textquotesingle{}s directory\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if the file was present and could be removed, \mbox{\hyperlink{basic_data_types_False}{False}} if the file did not exist \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ bool b = dir.removeFile(filename);} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+REMOVEFILE-\/\+PARAMETER-\/\+ERROR} & only filenames without path (i.\+e. without path separator characters) are allowed \\ \hline {\em DIR-\/\+REMOVEFILE-\/\+FAILURE} & the \mbox{\hyperlink{namespace_qore_aac76dbcada98d67b28a84e7296587b10}{unlink()}} function returned an error ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a3bccdd964feba716bd0fd16347db1bb2}\label{class_qore_1_1_dir_a3bccdd964feba716bd0fd16347db1bb2}} \index{Qore::Dir@{Qore::Dir}!rmdir@{rmdir}} \index{rmdir@{rmdir}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{rmdir()}{rmdir()}} {\footnotesize\ttfamily nothing Qore\+::\+Dir\+::rmdir (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{subdir }\end{DoxyParamCaption})} Removes a direct subdirectory from the \mbox{\hyperlink{class_qore_1_1_dir}{Dir}} object\textquotesingle{}s current path. \begin{DoxyParams}{Parameters} {\em subdir} & The subdirectory name to remove; only direct subdirectories are allowed; directory separator characters are not allowed\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ dir.rmdir(\textcolor{stringliteral}{"{}subdir"{}});} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+RMDIR-\/\+PARAMETER-\/\+ERROR} & only direct subdirectories are allowed \\ \hline {\em DIR-\/\+RMDIR-\/\+FAILURE} & error removing directory ({\ttfamily arg} will be assigned to the errno value)\\ \hline \end{DoxyExceptions} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{namespace_qore_a56d2abad877339557cdd3c04660e77e9}{Qore\+::rmdir()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}\label{class_qore_1_1_dir_a2f0527a017aacd49fe3545ca2e2d824d}} \index{Qore::Dir@{Qore::Dir}!stat@{stat}} \index{stat@{stat}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{stat()}{stat()}} {\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_dir_a93aaffa82395a3b69420e7ff980fdf41}{list}}$<$auto$>$ Qore\+::\+Dir\+::stat (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns a list of file status information for the current directory. If any errors occur an exception will be thrown \begin{DoxyReturn}{Returns} a \mbox{\hyperlink{group__filesystem__functions_stat_list}{Stat List}} giving information about the current directory \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ list l = dir.stat();} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+STAT-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+STAT-\/\+FAILURE} & error stat\textquotesingle{}ing directory ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_dir_a53181a09db1ea32f65bb6c6b50f4692d}\label{class_qore_1_1_dir_a53181a09db1ea32f65bb6c6b50f4692d}} \index{Qore::Dir@{Qore::Dir}!statvfs@{statvfs}} \index{statvfs@{statvfs}!Qore::Dir@{Qore::Dir}} \doxysubsubsection{\texorpdfstring{statvfs()}{statvfs()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$\mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}}$>$ Qore\+::\+Dir\+::statvfs (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash for the current directory. \begin{DoxyReturn}{Returns} a \mbox{\hyperlink{struct_qore_1_1_filesystem_info}{Filesystem\+Info}} hash for the current directory \end{DoxyReturn} \begin{DoxyParagraph}{Platform Availability\+:} \mbox{\hyperlink{group__option__constants_gaa2928b4710b3dd34f7bf5a9ba52e7548}{Qore\+::\+Option\+::\+HAVE\+\_\+\+STATVFS}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{try} \{} \DoxyCodeLine{ hash h = dir.statvfs();} \DoxyCodeLine{\} catch (hash ex) \{} \DoxyCodeLine{ stderr.printf(\textcolor{stringliteral}{"{}\%s: \%s"{}}, ex.err, ex.desc);} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em DIR-\/\+STATVFS-\/\+ERROR} & no directory is set \\ \hline {\em DIR-\/\+STATVFS-\/\+FAILURE} & error in statvfs ({\ttfamily arg} will be assigned to the errno value) \\ \hline \end{DoxyExceptions}