Skip to content

Instantly share code, notes, and snippets.

@baamenabar
baamenabar / move.php
Created September 25, 2014 19:02
PHP move all files and folders from one directory to a new directory
<?php
$dir = ".";//"path/to/targetFiles";
$dirNew = "viejo2014";//path/to/destination/files
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo '<br>Archivo: '.$file;
//exclude unwanted
if ($file=="move.php")continue;