$x=0;
do{
$nome = $percorso.$x.$file;
$x++;
}while(!file_exists($nome));