Well, it's a bit awkward, but this should work:
IDL> temp_dir = '/local/scratch/1940320[2000].cluster.name/temp/area'
IDL> temp_dir = mg_streplace(temp_dir, '(\[|\])', '\\$1', /global)
IDL> print, temp_dir
/local/scratch/1940320\\[2000\\].cluster.name/temp/area
IDL> temp_dir = mg_streplace(temp_dir, '\\\\', '\', /global)
IDL> print, temp_dir
/local/scratch/1940320\[2000\].cluster.name/temp/area
MG_STREPLACE
is available on GitHub.