Skip to content

Instantly share code, notes, and snippets.

@jessevondoom
Created June 9, 2011 16:31
Show Gist options
  • Save jessevondoom/1017117 to your computer and use it in GitHub Desktop.
Save jessevondoom/1017117 to your computer and use it in GitHub Desktop.
Quickly grabs a list of all files from a repo, queues them in an array, then mirrors the repo locally via PHP copy
$repo = json_decode(file_get_contents('https://github.com/api/v2/json/blob/all/cashmusic/DIY/master'));
$files = array_keys((array)$repo->blobs);
foreach ($files as $file) {
$path = pathinfo($file);
if (!is_dir('./source/'.$path['dirname'])) mkdir('./source/'.$path['dirname'],0777,true);
copy('https://raw.github.com/cashmusic/DIY/master/'.$file,'./source/'.$file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment