Function to generate unique filename with folder path.