Advertisement

05.21.2008 at 12:23PM PDT, ID: 23422159
[x]
Attachment Details

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

Asked by firearmz in Microsoft Visual C++.Net, Microsoft Visual C#.Net, Microsoft Programming

Tags: ,

Hello,

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,

FireArmzStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
using namespace System;
DateTime dt;
fstream file;
 
file.open(str_RPUFile.c_str(), ios::trunc);
 
// Enumerate all the files/subdirectories
while (true) { 
		dt.FromFileTime(FindFileData.ftLastWriteTime);
		
		if ((FindFileData.cFileName != wstring(L".")) && (FindFileData.cFileName != wstring(L".."))) {
			file << FindFileData.cFileName << L":" << dt.ToLongDateString << L":" << endl;
		}
}
 
 
Loading Advertisement...
 
[+][-]05.29.2008 at 04:03AM PDT, ID: 21667872

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C++.Net, Microsoft Visual C#.Net, Microsoft Programming
Tags: Visual Studio C++, 2005
Sign Up Now!
Solution Provided By: roytal
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.13.2008 at 02:14AM PDT, ID: 21777120

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628