Anonymous
public text v1 · immutable<?php
$x = 0;
// trailing slashes are important!
$from = '/home/valect/Desktop/temp/';
$to = '/home/valect/Desktop/mep/';
$folder_name = 'files';
// if you don't have write perms to move these files, this will loop forever
while (exec('ls '.$from.' | head -n 1000',$output)) {
$full_path = $to.$folder_name.$x;
exec('mkdir '.$full_path);
foreach($output as $file) {
exec('mv '.$from.$file.' '.$full_path.'/',$errors);
}
$x++;
}
?>