Php batch rename this program can be divided into simple single file rename, plus getfile to achieve batch Rename of files, $ path is the directory you want to rename, it can rename the description of the specified file type in the specified directory in batches. Very easy to use.
Batch rename php tutorials
This program can be divided into simple single file name duplication, plus getfile to achieveBatch File rename$ Path is the directory you want to rename. It can rename the description of the specified file type in the specified directory in batch. Very easy to use.
*/
$ Format = 'php ';
$ Path = 'www .bkjia.com /';
$ Files = getfile ($ path, $ format );
Foreach ($ files as $ v)
{
$ TV = basename ($ v );
List ($ name, $ ext) = explode ('.', $ TV );
$ Newname = $ path. time (). mt_rand (1,10000). '.'. $ ext;
If (rename ($ v, $ newname ))
{
Echo '. $ v.' is successfully renamed '. $ newname.' <br/> ';
}
}
Function getfile ($ path, $ format)
{
$ Dirs = array ();
Foreach (glob ("$ path *") as $ d)
{
$ Tmp = explode ('.', $ d );
$ K = end ($ tmp );
If (is_file ($ d) & ($ k = strtolower ($ format )))
{
$ Dirs [] = $ d;
}
}
Return $ dirs;
}
/*
Rename/12819320034756. php rename/12819402065296.php
Rename/12819320036890. php rename/12819402067216.php
Rename/12819320037133. php rename/12819402067656.php
This site original tutorials, graves Indicate source http://www.bkjia.com/phper/php.html
*/
?>