found on fieldtrip/eeglab mailing list, have tested
updates for finding directories