Avatar of firearmz
firearmzFlag for Germany asked on

Listing files in a directory and saving the filelist + mod_time ( datetime ) to a file


i want to enumerate all files in a given directory and write them down along with there last mod time.

I'm struggling with the datetime to wstring / outstream conversion.

Just see the attached code.
Maybe someone can show me the code to used to implement this using a XML file.
Or is XML to slow for such an task?

with best regards,

using namespace System;
DateTime dt;
fstream file;
file.open(str_RPUFile.c_str(), ios::trunc);
// Enumerate all the files/subdirectories
while (true) { 
		if ((FindFileData.cFileName != wstring(L".")) && (FindFileData.cFileName != wstring(L".."))) {
			file << FindFileData.cFileName << L":" << dt.ToLongDateString << L":" << endl;

Open in new window

.NET ProgrammingVisual C++.NETMicrosoft Development

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thanks for the response.

I've fixed the Problem myself.
My Solution ended up pretty similiar to the code you've provided.

best regards,

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes