FileSystem(s) root names

06 Dec 2010

How do you recover a pointer root names of the file systems?

IE a pointer to /sd, /local, /usb name list. For FTP cwd and dir commands.  

06 Dec 2010

Hi Dean,

You can do a directory listing of the root. Would this give you what you need? For example:

// example writing to SD card, sford

#include "mbed.h"
#include "SDFileSystem.h"

LocalFileSystem local("local");
SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board

int main() {

	printf("List of files in /\n");

	DIR *d;
	struct dirent *p;
	d = opendir("/");
    if(d != NULL) {
        while((p = readdir(d)) != NULL) {
        	printf(" - %s\n", p->d_name);
        }
    } else {
    	error("Could not open directory!");
    }
}

There is no real operating system here, so it is not like you are on linux etc, but I suspect this enough for now. Would be interested in any other feedback around more OS-like functions you feel you need.

Simon

06 Dec 2010 . Edited: 06 Dec 2010

Thank you Simon

Most of the FTP server works now.

But how do you get a file's/dir's attributes IE: mode & size, not just the name (xxx->d_name).

Dean.

02 Apr 2011

I know this is pretty old but it was the most helpful topic I found on what I searched for. Is there a way to do directories (meaning subdirectories containing files) with LocalFileSystem?

02 Apr 2011

Subdirectories aren't supported. Check the Handbook page for the LocalFileSystem, under "Implementation Details".

03 Apr 2011

Oh crap I missed that. Thanks.