Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $images_dir = '/home/xleo/tests/webm/images';
- if (chdir($images_dir)) {
- $files = scandir('.');
- foreach ($files as $oldname) {
- if (preg_match('/\d{4}.jpg$/', $oldname)) {
- $newname = preg_replace('/^.*(\d{4}.jpg)$/', '\1', $oldname);
- rename($oldname, $newname);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement