turn ofDirList into ofFileManager

Theo, it would be great if as well as being able to list directories, you could get the file sizes, last modified dates, rename files, delete files etc.

What do you think?

Actually this sort of thing is the reason why we are looking at the poco library.

Zach sent me some code that does dir list but with all sorts of other added stuff.

Check the thread on poco here:

Here is the quick directory list code using poco:

using Poco::DirectoryIterator;  
using Poco::File;  
using Poco::Path;  
using Poco::DateTimeFormatter;  
using Poco::DateTimeFormat;  
int main(int argc, char** argv)  
	std::string dir;  
	if (argc > 1)  
		dir = argv[1];  
		dir = Path::current();  
		DirectoryIterator it(dir);  
		DirectoryIterator end;  
		while (it != end)  
			Path p(it->path());  
			std::cout << (it->isDirectory() ? 'd' : '-')  
					  << (it->canRead() ? 'r' : '-')  
					  << (it->canWrite() ? 'w' : '-')  
					  << ' '  
					  << DateTimeFormatter::format(it->getLastModified(),  
					  << ' '  
					  << p.getFileName()  
					  << std::endl;  
	catch (Poco::Exception& exc)  
		std::cerr << exc.displayText() << std::endl;  
		return 1;  
	return 0;  
outputs clean stuff !!!  
-rw 2007-08-29 07:23:06 Desktop_.ini  
drw 2008-02-12 06:22:31 foundation  
-rw 2008-02-12 06:27:08 hello.cpp  
-rw 2008-02-12 06:27:11 pocoTest Debug.exe  
-rw 2008-02-12 06:23:17 pocoTest.mcp  
drw 2008-02-12 06:20:39 pocoTest_Data  
-rw 2008-02-11 21:34:00 poco_c_libs.lib  
-rw 2008-02-11 21:31:18 poco_foundation.lib  

It can also do network, ftp sftp, web upload, xml, events and file system stuff - so most likely will be super useful and become the base for better of addons.

Thanks Theo

For this project (the statue) I don’t want to install poco just for this task, as something will probably break or make the program larger.

Here is a first stab at something:


I am sure those commands are OS / compiler specific, but they work on Windows and Visual Express 2005. I haven’t got file size working, but that isn’t so much of a problem for me as I can just delete images where there are too many within a folder.

The dirList addon, what order does it return the file list in? date / alpha ?

I am pretty sure ofDirList is alphanumeric.
The file deletion stuff looks super simple! I’ll try it out on my mac and let you know how cross platform it is. Deleting files can be quite a scary power though :slight_smile: