Last active
April 23, 2018 05:13
-
-
Save greenpeas/e838efc791dad714cb0570f206219563 to your computer and use it in GitHub Desktop.
Mp3 music randomizer
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
<?php | |
$dir = './'; | |
$files = scandir($dir); | |
$list = []; | |
for ($i = 2; $i < count($files); $i++) { | |
$ext = substr($files[$i], -3, 3); | |
if ($ext != 'mp3') { | |
continue; | |
} | |
$newName = md5(uniqid()) . '.' . $ext; | |
echo $files[$i] . ' > ' . $newName . PHP_EOL; | |
rename($files[$i], $newName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment