Skip to content

Instantly share code, notes, and snippets.

@blaylockbk
Last active September 20, 2018 21:18
Show Gist options
  • Select an option

  • Save blaylockbk/b4219bde8d764219558c9b0b00b3ac68 to your computer and use it in GitHub Desktop.

Select an option

Save blaylockbk/b4219bde8d764219558c9b0b00b3ac68 to your computer and use it in GitHub Desktop.
make a directory if it doesn't exist, like a save dir, with os.path
import os
DIR = '/this/is/the/directory/name/'
if not os.path.exists(DIR):
os.makedirs(DIR)
@blaylockbk
Copy link
Author

may also link the photo viewer from my directory whenever an image directory is created

SAVE = '/uufs/chpc.utah.edu/common/home/u0553130/public_html/PhD/UWFPS_2017/time-height/CAPE/'
if not os.path.exists(SAVE):
    # make the SAVE directory
    os.makedirs(SAVE)
    # then link the photo viewer
    photo_viewer = '/uufs/chpc.utah.edu/common/home/u0553130/public_html/Brian_Blaylock/photo_viewer/photo_viewer.php'
    os.link(photo_viewer, SAVE+'photo_viewer.php')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment