Created
March 27, 2016 17:45
-
-
Save lsloan/9f44885ece94d4f30ff4 to your computer and use it in GitHub Desktop.
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 console | |
import editor | |
import os | |
import shutil | |
DOCUMENTS = os.path.expanduser("~/Documents") | |
old_name = editor.get_path() | |
new_name = os.path.join(DOCUMENTS, console.input_alert("Duplicate File", "Enter new name", os.path.relpath(old_name, DOCUMENTS))) | |
if os.path.exists(new_name): | |
console.hud_alert("Destination already exists", "error") | |
else: | |
shutil.copy(old_name, new_name) | |
##editor.open_file(os.path.relpath(new_name, DOCUMENTS)) # For old Pythonistas | |
editor.open_file(new_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment