When sanitizing names, preserve "." and ".." elements in paths.

"sanitize_foldername()" was too eager to remove "." characters, thus removing "." and "..".
When using a single folder, the final "." element would be replaced with "unknown".