Skip to content

Instantly share code, notes, and snippets.

@karthikax
Last active August 29, 2015 14:23
Show Gist options
  • Save karthikax/f817077b2560560f33de to your computer and use it in GitHub Desktop.
Save karthikax/f817077b2560560f33de to your computer and use it in GitHub Desktop.
PHP if file name contains 'word' delete it.
$dir = '.';
$files = scandir($dir);
foreach ( $files as $file ) {
if ( strpos($file,'word') !== false ) {
unlink( $file );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment