nl_tokens: / * borrowed from : https : // github . com / ryanmcgrath / wrench - js / blob / master / lib / wrench . js wrench . rmdirRecursive ( directory_path callback ) ;
pl_tokens: function rmdirRecursive ( dir , clbk ) { dir = resolve ( dir ) . fullPath ; if ( clbk === null || typeof clbk === 'undefined' ) clbk = function ( err ) { } ; fs . readdir ( dir , function ( err , files ) { if ( err ) return clbk ( err ) ; if ( ! files ) return clbk ( new Error ( 'fsExt.rmdirRecursive: removing folders failed, folder not exists' ) ) ; ( function rmFile ( err ) { if ( err ) return clbk ( err ) ; var <mask> = files . shift ( ) ; if ( filename === null || typeof filename === 'undefined' ) return fs . rmdir ( dir , clbk ) ; var file = dir + '/' + filename ; fs . lstat ( file , function ( err , stat ) { if ( err ) return clbk ( err ) ; if ( stat . isDirectory ( ) ) rmdirRecursive ( file , rmFile ) ; else fs . unlink ( file , rmFile ) ; } ) ; } ) ( ) ; } ) ; }