Skip to content

Instantly share code, notes, and snippets.

@mfcallahan
Last active November 23, 2022 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfcallahan/6ac515e792a45fb8b4f2795403ee9ed7 to your computer and use it in GitHub Desktop.
Save mfcallahan/6ac515e792a45fb8b4f2795403ee9ed7 to your computer and use it in GitHub Desktop.
Delete all ".pitemx" and ".pitem" files which are automatically downloaded when clicking the "Open in ArcMap/ArcGIS Pro" button in ArcGIS Online.
import os
from pathlib import Path
def main():
path = os.path.join(Path.home(), "Downloads")
proFileExt = ".pitemx"
arcMapFileExt = ".pitem"
for file in os.listdir(path):
if file.endswith(proFileExt) or file.endswith(arcMapFileExt):
try:
os.remove(os.path.join(path, file))
except OSError:
# Ignore errors
pass
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment