echo "devil";

Rename a file

28.06.2010 15:10 | PHP

If you are working with server-side files in PHP it might be helpful to be able to rename files. Just imagine a situation where you want to store data in a file on a temporary basis before moving it data to their appropiate location. PHP has the required function for this purpose and the syntax is quite simple.

rename( 'pathX/filenameX.txt', 'pathY/filenameY.txt' );

I recently used this function for a logging system, where every once in a while the log file needed to be reset and the data moved to a new backup file. Just to mention an example of use.

Tags: php function, rename, php

« Back «

Share |

RSS feed