-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathren.php
38 lines (37 loc) · 958 Bytes
/
ren.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require_once('config.inc.php');
$dirs=glob('*');
$dirs=array_filter($dirs, 'is_dir');
$dirs=array_diff($dirs,array('__others'));
foreach($dirs as $dir)
{
$name2=$dir;
//$name2=str_replace(array('\''),'’', $name2);
$name2=str_replace(array('’'),'\'', $name2);
$name2=str_replace(array(':'),'-', $name2);
$name2=str_replace(array('?'),'', $name2);
$name2=preg_replace('#\.+$#','',$name2);
if($dir !== $name2)
{
rename($dir, $name2);
var_dump($name2);
}
}
$dirs2=glob('__others/*');
$dirs2=array_filter($dirs2, 'is_dir');
foreach($dirs2 as $dir)
{
$name2=$dir;
//$name2=str_replace(array('\''),'’', $name2);
$name2=str_replace(array('’'),'\'', $name2);
$name2=str_replace(array(':'),'-', $name2);
$name2=str_replace(array('?'),'', $name2);
$name2=preg_replace('#\.+$#','',$name2);
if($dir !== $name2)
{
rename($dir, $name2);
var_dump($name2);
}
}
echo '<br/>'.date('Y-m-d H:i:s');
?>