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 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.

Writing output to the scratch folder will make your code portable, as this folder will always be available or created at execution time.

Usage notes

  • The scratch folder is guaranteed to exist when your script or model runs; and you will have write access to this folder.
  • The Scratch Folder environment is read-only; you cannot set the location directly.
    • If the Scratch Workspace environment has been set, the Scratch Folder environment will reflect this value first.
      • If your Scratch Workspace environment references a geodatabase, the Scratch Folder environment value will be the folder in which the geodatabase resides.
      • If your Scratch Workspace environment points to a folder, the Scratch Folder environment will be a folder named scratch in the scratch workspace location. If the folder named scratch does not exist, one will be created.
    • If the Scratch Workspace environment has not been set, the Scratch Folder environment defaults to a folder within the AppData section of the User Profile, typically C:\Users\<user_name>\AppData\Local\Temp\1\scratch.
  • Files written to the Scratch Folder environment are not automatically deleted. You will need to do your own cleanup.

Dialog syntax

Note:

The Scratch Folder environment is only available in Python and models.

Scripting syntax

arcpy.env.scratchFolder

Script example

import arcpy

print(arcpy.env.scratchFolder)

Related topics

  • Scratch GDB (Environment setting)

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

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