Batch exporting of multiple objects into separate STL files
I actually found 3 issues with the original script:


Your path creation line did not check to see if the path already existed
Your stl export line used an incorrect parameter ("use_selection=true")
Your path variable did not include the ending backslash so it was concatenating the stl folder name and object name


Here's my version of the working script:

import bpy
import os

# get the current path and make a new folder for the exported meshes
path = bpy.path.abspath('//stlexport/')

if not os.path.exists(path):
    os.makedirs(path)

for object in bpy.context.selected_objects:

    # deselect all meshes
    bpy.ops.object.select_all(action='DESELECT')

    # select the object
    object.select = True

    # export object with its name as file name
    fPath = str((path + object.name + '.stl'))

    #bpy.context.active_object = object
    bpy.ops.export_mesh.stl(filepath=fPath)