<?
/*
Change all audio files right (owner and group)
Start script with Putty :
php /home/em/audio/import/change_all_files_group_and_user.php
*/

$own = 'adminftp';
$grp = 'adminftp';

$path_explore = '../fichiers/';

exec('ls '.$path_explore,$tab_output);

foreach($tab_output as $i => $current_dir) {
   echo $path_explore.$current_dir."\n";
   chown($path_explore.$current_dir,$own);
   chgrp($path_explore.$current_dir,$grp);


   $tab_output_2 = array();
   exec('ls '.$path_explore.$current_dir,$tab_output_2);

   foreach($tab_output_2 as $j => $file) {
      $file_to_change = $path_explore.$current_dir.'/'.$file;
      echo $file_to_change."\n";
      chown($file_to_change,$own);
      chgrp($file_to_change,$grp);
   }

}

?>