lib/init.js
function cleanDir( path ) {
    var files = FS.readdirSync( path );
    try {
        files.forEach( function ( file ) {
            var fullpath = Path.join( path, file );
            if ( !FS.existsSync( fullpath ) ) return;
            var stat = FS.statSync( fullpath );
            try {
                if ( stat.isDirectory() ) PathUtils.rmdir( fullpath );
                else FS.unlinkSync( fullpath );
            } catch ( ex ) {
                console.error( "Unable to delete `" + fullpath + "`!" );
                console.error( ex );
            }
        } );
    } catch ( ex ) {
        fatal( "Fatal error in function `files`!\n" + JSON.stringify( ex, null, '  ' ) );
    }
}
function cleanDir( path ) {
    var files = FS.readdirSync( path );
    try {
        files.forEach( function ( file ) {
            var fullpath = Path.join( path, file );
            if ( !FS.existsSync( fullpath ) ) return;
            var stat = FS.statSync( fullpath );
            try {
                if ( stat.isDirectory() ) PathUtils.rmdir( fullpath );
                else FS.unlinkSync( fullpath );
            } catch ( ex ) {
                console.error( "Unable to delete `" + fullpath + "`!" );
                console.error( ex );
            }
        } );
    } catch ( ex ) {
        fatal( "Fatal error in function `files`!\n" + JSON.stringify( ex, null, '  ' ) );
    }
}
function cleanDir ( path ) { var files = FS . readdirSync ( path ) ; try { files . forEach ( function ( file ) { var fullpath = Path . join ( path , file ) ; if ( ! FS . existsSync ( fullpath ) ) return ; var stat = FS . statSync ( fullpath ) ; try { if ( stat . isDirectory ( ) ) PathUtils . rmdir ( fullpath ) ; else FS . unlinkSync ( fullpath ) ; } catch ( ex ) { console . error ( "Unable to delete `" + fullpath + "`!" ) ; console . error ( ex ) ; } } ) ; } catch ( ex ) { fatal ( "Fatal error in function `files`!\n" + JSON . stringify ( ex , null , '  ' ) ) ; } }
Remove all the files and folder in `path`, but not `path` itself.
Remove all the files and folder in path but not path itself .