Added sanitize function to sanitize filenames

Added sanitize function to sanitize filenames (only letters, digits, dash, underscore and dots).

I frequently get files from others with capital letters, spaces, etc. This function cleans up the file names.