Created
November 3, 2011 09:28
-
-
Save perifer/1336127 to your computer and use it in GitHub Desktop.
Script to move download/recreated features to correct folder. Perfect as an Automator Folder Action.
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 sys | |
import os | |
import os.path | |
import re | |
import subprocess | |
import shutil | |
destination = "/Users/USER/Projects/SITE/public_html/sites/all/modules/feauters" | |
module = re.compile(r".*/(PREFIX)[^/]*.tar$") | |
for f in sys.argv[1:]: | |
match = module.match(f) | |
if match: | |
module_dir = os.path.join(destination, match.group(1)) | |
if os.path.exists(module_dir): | |
shutil.rmtree(module_dir) | |
subprocess.call(["tar", "xf", f, "-C", destination]) | |
os.remove(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment