rewrite attach_dir_desc

Rewrite as per https://github.com/SimpleMachines/SMF2.1/issues/288
<br/> I agree to the DCO 1.1 at https://github.com/SimpleMachines/SMF2.1/commit/b486a1e52a5f4f1b9ffae37defc6cd864926267d#DCO.txt