SdFat library Change output style of sd.ls(LS_R)
I am currently trying to have fun Modding my own sd.ls().

Worst way, modifying the library:

Go into FatFilePrint.cpp 

(Suggestion: Create yourself a new 'flag' like LS_COMMA)

Find the line

void FatFile::ls(print_t* pr, uint8_t flags, uint8_t indent) { ...


add your flag

if (flag &amp; !LS_COMMA) {
   pr--&gt;write(':');
} else {
    //original library set of 
    // pr-&gt;write(stuff);
}


--> SuperClass version # (prefered )

this will override the original ls() method by creating a new Class inheriting from the original one.

rather then invoking it from "volume", 
    sd.ls( your params);

invoke it from a directory file instead.

superFatFile rootDir;
rootDir.open("/");
rootDir.ls( __your_params__);


Place this superClass declaration in your .h
don't hesitate to remove any of the "flags" related code if YOUR requirement never calls for them.

class superFatFile : public FatFile {
    public:
    void ls(print_t* pr, uint8_t flags /* = 0 */, uint8_t indent /* = 0 */){
        superFile file;
        rewind();
        while (file.openNext(this, O_READ)) {
            if (!file.isHidden() || (flags &amp; LS_A)) {
                // adds 'spaces' indent for dir level
                for (uint8_t i = 0; i &lt; indent; i++) {
                    pr-&gt;write(' ');
                }

                if (flags &amp; LS_DATE) {
                    file.printModifyDateTime(pr);
                    pr-&gt;write(' ');
                }

                if (flags &amp; LS_SIZE) {
                    file.printFileSize(pr);
                    pr-&gt;write(' ');
                }

                // prints filename
                if (!file.isDir()) {    
                    file.printName(pr);
                    pr-&gt;write('\r');
                    pr-&gt;write('\n');    // HERE IS YOUR SEPARATOR CARACTERS !!!
                }

                // execute recursivly if LS_R flag was set
                if ((flags &amp; LS_R) &amp;&amp; file.isDir()) file.ls(pr, flags, indent + 2);

            }

        }
        file.close();
    } // end of new LS method
}; // end of superClass