Skip to content

Instantly share code, notes, and snippets.

@ertuncefeoglu
Created September 24, 2013 10:31
Change file encoding for code scripts using PHP
<?php
function deltree( $f ,$filename,$remove=false){
if( is_dir( $f ) ){
foreach( scandir( $f ) as $item ){
if( !strcmp( $item, '.' ) || !strcmp( $item, '..' ) || !strcmp( $item, '.svn' ) )
continue;
$path= $f . "/" . $item;
deltree($path,$filename,$remove );
}
} else {
if ($remove) {
// echo $f."*********";
shell_exec ("iconv -f ISO-8859-9 -t UTF8 $f -o $f.old" );
shell_exec ("mv -f $f.old $f" );
} else {
echo "$f <br>";
}
}
}
echo "START<br>";
$pth="C:\workspace\DSAP\html\test\Layouts";
$pth="./Layouts";
// calistirmak icin deltree fonk un basindaki comment i kaldiriniz
deltree($pth,'svn',true);
echo "OK";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment