#include <xtd/xtd>
class program {
public:
static auto main() {
try {
console::write_line("Enter the path to a directory:");
if (!dir.exists()) {
}
std::vector<xtd::sptr<file_system_info>> infos = dir.get_file_system_infos();
console::write_line("Working...");
list_directories_and_files(infos);
console::write_line("Directories: {0}", directories);
console::write_line("Files: {0}", files);
console::write_line(
e.message());
}
}
private:
if (is<directory_info>(i)) {
directories++;
list_directories_and_files(d_info->get_file_system_infos());
}
else if (is<file_info>(i)) {
files++;
}
}
}
inline static long files = 0;
inline static long directories = 0;
};
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.h:26
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories...
Definition directory_info.h:129
The exception that is thrown when part of a file or directory cannot be found.
Definition directory_not_found_exception.h:29
Exposes static methods for creating, moving, and enumerating through directories and subdirectories....
Definition directory.h:101
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:175
#define csf_
Provides information about the current stack frame.
Definition current_stack_frame.h:30
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.h:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10