Ver Mensaje Individual
  #13 (permalink)  
Antiguo 14/06/2013, 09:39
Avatar de zeuzft
zeuzft
 
Fecha de Ingreso: junio-2009
Ubicación: peru
Mensajes: 358
Antigüedad: 14 años, 10 meses
Puntos: 2
Exclamación Respuesta: saber si carpeta de otro dominio existe

haciendo algunos cambios y poder copiar todos los archivos tuve que ejecutar el siguiente codigo desde la barra de direcciones y funciona normal:
Código PHP:
$miconexion->consulta("Select anun_id from anuncio where anun_pas<>0");
    
    if (
$miconexion->numregistros()>0)
    {                
        while(
$row mysql_fetch_array($miconexion->Consulta_ID))
        {
            
$anun_id=$row["anun_id"];
            
            
/////////////*********///////////////
                //carpeta de origen
                
$carpeta="dominioA/anuncios/".$anun_id."/";
                
$carpeta_t="dominioA/anuncios/".$anun_id."/tumbnail/";
                
                
//carpeta de destino
                    
$carpeta1="/copia/anunciosp/".$anun_id."/";
                    
$carpeta1_t="/copia/anunciosp/".$anun_id."/tumbnail/";
                
                
//VERIFICO SI LA CARPETA DEL ANUNCIO EXISTE COPIO IMAGENES
                
if (@ftp_chdir($conn_id$carpeta))
                {
                    if (
ftp_chdir($conn_id$origen)==true)
                    {
                        if (!
is_dir($carpeta1))
                        {
                            @
mkdir($carpeta10700);
                            @
mkdir($carpeta1_t0700);
                        }
                        
//COPIO IMAGENES PRINCIPALES
                        
for ($i 1$i 6$i++)
                            {
                                
$remote_file $origen.$carpeta.$anun_id.'_'.$i.'.jpg';
                                
$local_file $_SERVER['DOCUMENT_ROOT'].$carpeta1.$anun_id.'_'.$i.'.jpg';
                                
                                if (@
ftp_get($conn_id$local_file$remote_fileFTP_BINARY))
                                {
                                    if (
ftp_put($conn_id$remote_file$local_fileFTP_BINARY)) {
                                        echo 
'El archivo ' $local_file ' se ha cargado en el servidor remoto.' "<br />";
                                    } else {
                                        echo 
'El archivo ' $local_file ' NO se ha cargado en el servidor remoto.' "<br />";
                                    }
                                }
                            }
                        
                        
//COPIO IMAGENES SECUNDARIAS
                        
for ($i 1$i 6$i++)
                            {
                                
$remote_files $origen.$carpeta_t.$anun_id.'_'.$i.'.jpg';
                                
$local_files $_SERVER['DOCUMENT_ROOT'].$carpeta1_t.$anun_id.'_'.$i.'.jpg';
                                
                                if (@
ftp_get($conn_id$local_files$remote_filesFTP_BINARY))
                                {
                                    if (
ftp_put($conn_id$remote_files$local_filesFTP_BINARY)) {
                                        echo 
'El archivo ' $local_files ' se ha cargado en el servidor remoto.' "<br />";
                                    } else {
                                        echo 
'El archivo ' $local_files ' NO se ha cargado en el servidor remoto.' "<br />";
                                    }
                                }
                            }
                    }
                }
            
/////////////*********///////////////
        
}
    } 
pero ahora el problema es como lo ejecuto desde el cron?:
para el cron utilizo la siguiente estructura:
Cita:
0 0 * * * miuser midominioA/copia/copia.php
pero no se llegua a ejecutar pues no veo las carpetas ni las imagenes; en algunos casos he visto que usan un system; en ese caso eso se puede aplicar?