JSFiddle - React, Tailwind, and code Playground

by Lazaro Contreras

HTML

<input type='button' onclick='listFiles()' value='List Files'/>
<div id="files"/>

JavaScript

var fso = new ActiveXObject("Scripting.FileSystemObject"); 

    function ShowFolderFileList(folderspec){

        var s = "";
        var f = fso.GetFolder(folderspec);

    // recurse subfolders
    var subfolders = new Enumerator(f.SubFolders);
    for(; !subfolders.atEnd(); subfolders.moveNext()){s+=ShowFolderFileList((subfolders.item()).path);}  

    // display all file path names.
    var fc = new Enumerator(f.files);
        for (; !fc.atEnd(); fc.moveNext()){s += fc.item() + "<br>";}

        return s; 
    }
function listFiles(){
    document.getElementById('files').innerHTML = ShowFolderFileList('C:');
    }