The BrowseFiles class provides means to iterate through the content of a directory.
AutoAlloc<BrowseFiles> bf;
if (bf == nullptr)
bf->Init(folderName, bfFlags);
while (bf->GetNext())
{
maxon::String sIsBundle =
"_"_s, sIsHidden =
"_"_s, sIsReadOnly =
"_"_s, sIsDir =
"_"_s;
LocalFileTime timeCreated;
if (bf->IsBundle())
sIsBundle = "b"_s;
if (bf->IsHidden())
sIsHidden = "h"_s;
if (bf->IsReadOnly())
sIsReadOnly = "r"_s;
if (bf->IsDir())
sIsDir = "d"_s;
else
sSize = maxon::String::MemorySizeToString(bf->GetSize());
sTimeCreated = maxon::String::IntToString(timeCreated.year);
sTimeCreated += "-"_s + maxon::String::IntToString(timeCreated.month);
sTimeCreated += "-"_s + maxon::String::IntToString(timeCreated.day);
sTimeCreated += " "_s + maxon::String::IntToString(timeCreated.hour);
sTimeCreated += ":"_s + maxon::String::IntToString(timeCreated.minute);
sTimeCreated += ":"_s + maxon::String::IntToString(timeCreated.second);
FileGetAttributesString(folderName + bf->GetFilename(), sAttr)
iferr_return;
ApplicationOutput(
"[@ @ @ @] - @ - @ - @ - @"_s, sIsDir, sIsBundle, sIsHidden, sIsReadOnly, sSize, sTimeCreated, sAttr, fileName);
}
Definition: string.h:1287
DIRECTORY
Folder selection dialog.
Definition: ge_prepass.h:2
ANYTHING
Any file.
Definition: ge_prepass.h:0
#define BROWSEFILES_CALCSIZE
Specifies if BrowseFiles::GetSize() can be called later on. Only works for files, not for folders.
Definition: c4d_file.h:914
return OK
Definition: apibase.h:2740
#define GE_FILETIME_CREATED
File time created.
Definition: c4d_file.h:906
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
maxon::Int32 Int32
Definition: ge_sys_math.h:51
#define iferr_return
Definition: resultbase.h:1531