LinksTraffic - Links and traffic exchange system

Rename files inside a directory

english directory french directory
Search: Advanced Search

Rename files inside a directory

Copy and paste the following code into your editor and run it (code comments are included). You can add as many features as you wish from this piece of code.

If you want to see the live result (we believe this is the best way to learn what is the script about), try it here (new window).

The source code

This example browses a directory to list files and rename all files except the ones we do not want to list (as 'Thumbs.db' on windows or '..' and '.' which are not files as well as a directory itself).

download the file

Notes:
- we use the is_dir function to avoid renaming a directory;
- you need to have the necessary permissions to be able to write into a file on your server (see chmod on linux/unix).

You may wish to read additional materials from:
- http://us.php.net/rename
- function.opendir.php
- function.readdir.php
- function.is-dir.php

Post a comment

Webmaster Corner

The ClickBnk Code
Another Killer Product From Michael Jones, simply follow the Blueprint For Easy Online Wealth Using Click Bank...

Mass Article Control #1
Create Thousands Of Articles From only 1 Article and Have them Submitted Automatically With A brand New Submitter!

iPowerWeb
Incredible Membership Packages - Web Hosting!

Maverick Money Makers - Get Paid For Life!

Categories

Copyright 2004-2010 @ LinksTraffic RHM Solution ::: Partners | Privacy | Contact us form