Copy file from source to target with some php condition


sanjaypatel07

function full_copy_directory_MobileVersion( $source, $target )
{
if ( is_dir( $source ) ) {
@mkdir( $target , 0777);
$d = dir( $source );

while ( FALSE !== ( $entry = $d->read() ) ) {
if ( $entry == ‘.’ || $entry == ‘..’ ) {
continue;
}

if($entry != ‘ogv’ && $entry != ‘webm’ && $entry != ‘common’ && $entry != ‘extend’ && $entry != ‘unique’ && $entry != ‘vocab’){

$Entry = $source . ‘/’ . $entry;
if ( is_dir( $Entry ) ) {

full_copy_directory_MobileVersion( $Entry, $target . ‘/’ . $entry );
continue;
}

$xsd_extension = strstr($Entry, ‘.xsd’);
$xml_extension = strstr($Entry, ‘.xml’);
$dtd_extension = strstr($Entry, ‘.dtd’);

if($xsd_extension !=’.xsd’ && $xml_extension !=’.xml’ && $dtd_extension !=’.dtd’ )
copy( $Entry, $target . ‘/’ . $entry );
}

}

$d->close();

}else {
copy( $source, $target );

}
}

View original post

Advertisements

2 thoughts on “Copy file from source to target with some php condition

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s