I need a lot of help! I would make the code below, I copied the folder along with the files inside it to the folder "Backup_Archives" ie in the folder uploads will have:
uploads/a1/arq.pdf
uploads/a2/arq2.pdf
So the Backup folder will be after copying:
Backup_Archives/a1 /arq.pdf
Backup_Archives/a2/arq2.pdf
I would like the folders / files to be copied and after the copy is done, delete all the files inside the subfolders, such as:
uploads/a1/ "arq.pdf"
uploads/a2/ "arq2.pdf"
CODE:
<?php
// pega a lista de arquivos com a extensão pdf.
$list = glob(__dir__.'/uploads/a1/*.pdf');
// diretorio aonde serão remanejados.
$save = __dir__.'/uploads/Backup_Arquivos/';
echo 'Nenhum arquivo será movido caso nenhuma mensagem abaixo apareça!<br>';
foreach ($list as $value) {
if (rename($value, $save.basename($value))) {
echo '<br>Item da Enviado com êxito! <br>';
}
}
?>
Note: My code is only moving the files from a folder to the Backup_Files folder.
Thank you!