how to create directories inside 'data'

My project is capturing a large number of images over a few weeks. I want to keep them organized by creating nested directories by date and time as needed. I haven’t been able to figure out how to do this.

system(“mkdir -p 2011/11/25”);

I’m running on Mac OS 10.6 with xcode 3.2.3 and oF 0061.

Thanks for any help or if anyone can suggest a better way of organizing images - one every two seconds for a couple of weeks. Even better would be a way to store the files in /Volumes/external-drive/2011/11/25/…


you want to use ofDirectory for this, like ofDirectory::createDirectory().

the reason mdkir doesn’t work is because the working directory of your app is not the data folder, but it’s inside the .app package.

great thanks. I can’t see that function in the docs is it part of an addon? If so, do you have a link for download?

Also is it possible to create dirs or write files to arbitrary places in the filesystem (permissions permitting)?


Sure, both system(“mkdir”) would allow you to do that as would ofDirectory::createDirectory(), but make sure that your file file paths are correct relative to your application itself, which on osx will be inside .app/Contents/MacOS

Thanks for the help. Im using 0061 so i tried the system call with a full path (/tmp/foo/bar) and it worked fine. Will definitely check out ofDirectory once I upgraded my xcode and got the new 007.