There is a code for working with images, the purpose of which is, and compression of images. Problems arise in the lack of resources. Scripting is incomplete with error 504.
function backupimage($dir){ foreach (scandir($dir) as $key) { $imageiofile = "/home/bitrix/ext_www/" . "host.svarbi.ru/upload/iblock/".$key."/*.*"; foreach (glob($imageiofile) as $filename) { // echo basename($filename)."\n"; $newfile = "/home/bitrix/ext_www/host.svarbi.ru/ttt/aaa/" .$key."/".basename($filename); if (!copy($filename, $newfile)) { echo "не удалось скопировать $file...\n"; } } } } backupimage($dir); It is necessary to break it all into pieces and do it. Which algorithm is better for this?
php /path/to/my/script.php. Alternatively, enter an interpreter (#!/path/to/php) at the beginning of the file, and set the rights to execute (+x) the php file, and simply write it in cron. so there is no need for a bash or a python - teran