Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. <?php
  2. $images_dir = '/home/xleo/tests/webm/images';
  3.  
  4. if (chdir($images_dir)) {
  5. $files = scandir('.');
  6. foreach ($files as $oldname) {
  7. if (preg_match('/\d{4}.jpg$/', $oldname)) {
  8. $newname = preg_replace('/^.*(\d{4}.jpg)$/', '\1', $oldname);
  9. rename($oldname, $newname);
  10. }
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement