Use readdir_r instead of scandir in recursive_delete().
Make readdir_r work on windows and check the return of bopen properly in
receive_a_file().