$changingfiles = array('0'=> '14aa.xlsx','1'=> '14bb.xlsx','2'=> '14ii.xlsx','3'=> '15t.xlsx','4'=> '15aa.xlsx','5'=> '15bb.xlsx','6'=> '15ddд.xlsx','7'=> '15zh.xlsx','8'=> '15ii.xlsx','9'=> '16aa.xlsx','10'=> '16bb.xlsx','11'=> '16vv.xlsx','12'=> '16zh.xlsx','13'=> '16z.xlsx','14'=> '16ii.xlsx','15'=> '16mm.xlsx','16'=> '17aa.xlsx','17'=> '17bb.xlsx','18'=> '17в.xlsx','19'=> '17ж.xlsx','20'=> '17zz.xlsx','21'=> '17и.xlsx','22'=> '17м.xlsx','23'=> '17nn.xlsx','24'=> '23с.xlsx','25'=> '24g.xlsx','26'=> '24aa.xlsx','27'=> '24bb.xlsx','28'=> '24vv.xlsx','29'=> '24ee.xlsx','30'=> '24pp.xlsx','31'=> '24cc.xlsx','32'=> '25aa.xlsx','33'=> '25bb.xlsx','34'=> '25vv.xlsx','35'=> '25gg.xlsx','36'=> '25dd.xlsx','37'=> '25ee.xlsx','38'=> '25zz.xlsx','39'=> '25ii.xlsx','40'=> '25ll.xlsx','41'=> '25mm.xlsx','42'=> '25cc.xlsx','43'=> '25tt.xlsx','44'=> '25ff.xlsx','45'=> '26aa.xlsx','46'=> '26bb.xlsx','47'=> '26vv.xlsx','48'=> '26gg.xlsx','49'=> '26dd.xlsx','50'=> '26ee.xlsx','51'=> '26zz.xlsx','52'=> '26ii.xlsx','53'=> '26kk.xlsx','54'=> '26mm.xlsx','55'=> '26pp.xlsx','56'=> '26cc.xlsx','57'=> '26tt.xlsx','58'=> '27ii.xlsx','59'=> '27qq.xlsx','60'=> '27aa.xlsx','61'=> '27bb.xlsx','62'=> '27vv.xlsx','63'=> '27gg.xlsx','64'=> '27dd.xlsx','65'=> '27ee.xlsx','66'=> '27zz.xlsx','67'=> '27ii.xlsx','68'=> '27mm.xlsx','69'=> '27pp.xlsx','70'=> '27cc.xlsx','71'=> '27tt.xlsx','72'=> '34aa.xlsx','73'=> '34bb.xlsx','74'=> '35aa.xlsx','75'=> '35bb.xlsx','76'=> '35ee.xlsx','77'=> '35zh.xlsx','78'=> '35pp.xlsx','79'=> '36aa.xlsx','80'=> '36bb.xlsx','81'=> '36vv.xlsx','82'=> '36zh.xlsx','83'=> '36pp.xlsx','84'=> '37aa.xlsx','85'=> '37bb.xlsx','86'=> '37vv.xlsx','87'=> '37zh.xlsx','88'=> '37nn.xlsx','89'=> '37pp.xlsx','90'=> '37tt.xlsx','91'=> '44aa.xlsx','92'=> '44vv.xlsx','93'=> '44dd.xlsx','94'=> '44ee.xlsx','95'=> '44cc.xlsx','96'=> '45aa.xlsx','97'=> '45bb.xlsx','98'=> '45vv.xlsx','99'=> '45dd.xlsx','100'=> '45ee.xlsx','101'=> '45pp.xlsx','102'=> '45cc.xlsx','103'=> '46aa.xlsx','104'=> '46bb.xlsx','105'=> '46vv.xlsx','106'=> '46gg.xlsx','107'=> '46dd.xlsx','108'=> '46ee.xlsx','109'=> '46pp.xlsx','110'=> '46cc.xlsx','111'=> '47aa.xlsx','112'=> '47bb.xlsx','113'=> '47vv.xlsx','114'=> '47gg.xlsx','115'=> '47dd.xlsx','116'=> '47ee.xlsx','117'=> '47mm.xlsx','118'=> '47pp.xlsx','119'=> '47cc.xlsx','120'=> '54pp.xlsx','121'=> '55aa.xlsx','122'=> '55bb.xlsx','123'=> '55vv.xlsx','124'=> '55gg.xlsx','125'=> '55zh.xlsx','126'=> '55ii.xlsx','127'=> '55kk.xlsx','128'=> '55ll.xlsx','129'=> '55mm.xlsx','130'=> '55nn.xlsx','131'=> '55oo.xlsx','132'=> '55pp.xlsx','133'=> '55pp.xlsx','134'=> '55cc.xlsx','135'=> '55yy.xlsx','136'=> '55ff.xlsx','137'=> '55cc.xlsx','138'=> '55ja.xlsx','139'=> '56aa.xlsx','140'=> '56bb.xlsx','141'=> '56vv.xlsx','142'=> '56ee.xlsx','143'=> '56zh.xlsx','144'=> '56zh.xlsx','145'=> '56ii.xlsx','146'=> '56kk.xlsx','147'=> '56ll.xlsx','148'=> '56mm.xlsx','149'=> '56nn.xlsx','150'=> '56oo.xlsx','151'=> '56pp.xlsx','152'=> '56cc.xlsx','153'=> '56ff.xlsx','154'=> '56xx.xlsx','155'=> '56cz.xlsx','156'=> '56iu.xlsx','157'=> '57aa.xlsx','158'=> '57bb.xlsx','159'=> '57gg.xlsx','160'=> '57kk.xlsx','161'=> '57mm.xlsx','162'=> '57pp.xlsx','163'=> '57cc.xlsx','164'=> '57ff.xlsx','165'=> '57iu.xlsx');
$i = 0;
$allfiles = glob("*.xlsx");
while(count($allfiles)){
foreach ($files as $key) {
if (!file_exists("raitingTo/".$key[$i++]."")) {
$changes = rename("".$key[$i++]."", "raitingTo/".$key[$i++]."");
}else{
$changes = unlink("raitingTo/".$key[$i++]);
$changes = rename("".$key[$i++]."", "raitingTo/".$key[$i++]."");
}
}
}
Проблема в том, что максимальный рекорд был 111 файлов, а после пишет, что не удалось подключиться к серверу, а так, в среднем 54 файла, всего 166 файлов, как быть?