Created
September 17, 2017 16:13
-
-
Save TheNewHEROBRINEX/86f27f46c4757fd3c6a85b8d462bf307 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
#!/usr/bin/env php | |
<?php | |
$opts = getopt("", ["phar:", "target:"]); | |
if(!isset($opts["phar"]) or !isset($opts["target"])) { | |
exit(1); | |
} | |
$pharPath = "phar://".$opts["phar"]; | |
$folderPath = $opts["target"].DIRECTORY_SEPARATOR.basename($opts["phar"], ".phar"); | |
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($pharPath)) as $fInfo){ | |
$path = $fInfo->getPathname(); | |
@mkdir(dirname($folderPath . str_replace($pharPath, "", $path)), 0755, true); | |
file_put_contents($folderPath . str_replace($pharPath, "", $path), file_get_contents($path)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment