fs: use an iterative algorithm for 'mkdir_recursive'

as requested in #6109
fs: use an iterative algorithm for 'rmdir_recursive'