Last active
February 28, 2016 22:24
-
-
Save rsmoz/6ebf704afacf6c81bfd0 to your computer and use it in GitHub Desktop.
Copies a Sample playground from Documents to Desktop and opens it in Xcode. I trigger this from an Alfred workflow.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil, errno, subprocess | |
def recurse(n): | |
fileAt = '/Users/rmozayeni/Desktop/Sample%s.playground' % ("" if n == 0 else str(n)) | |
try: | |
shutil.copytree('/Users/rmozayeni/Documents/Sample.playground', fileAt) | |
except OSError as e: | |
if e.errno == errno.EEXIST: | |
return recurse(n+1) | |
else: exit(1) | |
return fileAt | |
subprocess.call(['open', recurse(0)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment