ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Scratch Folder (Environment setting)

  • Usage notes
  • Dialog syntax
  • Scripting syntax

The Scratch Folder environment setting is the location of a folder you can use to write file-based data, such as shapefiles, text files, and layer files. It is a read-only environment managed by ArcGIS.

The scratch folder environment complements the Scratch Workspace environment. Its primary purpose is for use by scripts and models as geoprocessing services, with the added focus of pointing only to a known folder. When ArcGIS Server executes a geoprocessing task, the scratch folder is always available to write output to. This environment is also useful in authoring scripts and models for use on the desktop. Writing output to the scratch folder will make your tool portable, because this location will always be available or created at execution time.

Usage notes

  • The scratch folder is guaranteed to exist when your script or model runs; you will have write access to the folder.
  • The scratch folder environment is read-only; you cannot set the location directly.
    • If your map document has a scratch workspace set, the scratch folder will reflect this value first.
      • If your scratch workspace references a geodatabase, the scratch folder environment value will be the folder in which the scratch geodatabase resides.
      • If your scratch workspace points to a folder, the scratch folder will be a folder named scratch in the scratch workspace location. If the folder named scratch does not exist in the scratch workspace, one will be created.
    • If the scratch workspace has not been set, the scratch folder defaults to the current user's Documents directory. On Windows 7 and 8, this directory is C:\Users\<user>\Documents\ArcGIS. The scratch folder will be created in this directory.
  • Files written to the scratch folder are not automatically deleted. You will need to do your own cleanup.
  • The scratch folder can be used in your Python scripts. Make sure to set your scratch workspace variable prior to using it; this way, you know where the output will be generated.

Dialog syntax

Note:

The scratch folder environment is only available in Python and models.

Scripting syntax

arcpy.env.scratchFolder

Script example

import arcpy
arcpy.env.scratchWorkspace = 'c:/LandUse/ForestCover'

# c:\LandUse\ForestCover\scratch
print(arcpy.env.scratchFolder)

Related topics

  • Scratch GDB (Environment setting)

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2019 Esri. | Privacy | Legal