shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] Manter arquivo mais recente.


From: Jose NIEVIADONSKI
Subject: Re: [shell-script] Manter arquivo mais recente.
Date: Tue, 22 Oct 2002 13:52:26 -0300

Oi.

Não tive tempo de testar exaustivamente o script abaixo, mas acho que
funciona.

#!/usr/bin/ksh

find  /zeus/root/home/squirrel/  -type f |
while read arq
do
    orig=${arq:##*/}
    if [[ ! -f /home/squirrel/$orig ]]
    then
        echo Arquivo $arq nao existe. Copiando $arq para /home/squirrel
/$orig
        cp $arq /home/squirrel/$orig
    else
       if [[ $arq -nt /home/squirrel/$orig ]]
       then
          echo Arquivo $arq mais novo. Copiando $arq para /home/squirrel/
$orig
           cp $arq /home/squirrel/$orig
       fi
    fi
done

Estou supondo que existe pelo menos a mesma estrutura de diretórios e
subdiretórios nos dois diretórios citados.


José Augusto Martins Nieviadonski
Analista de Suporte Consultor
HSBC Bank Brasil S.A. Banco Multiplo
Treinamento de Informática
address@hidden




                          
                          
                          
                          
                          
                          
                          


 Enviado Por :    <address@hidden> - 22/10/02 13:10
         Responder a shell-script

 Para:   <address@hidden>
 cc:     (cco: Jose NIEVIADONSKI/HBBR/HSBC)
 Assunto:   [shell-script] Manter arquivo mais recente.


tenho dois diretorios.

/home/squirrel/
e
/zeus/root/home/squirrel/

com a mesma estrutura, mas na nora da migracao do webmail deu
um "pau" e terminou que os usuarios criaram modificacoes nos
dois lugares.Em fim...

Precisaria que para cada arquivo dentro do /home/squirrel/
fosse verificada a existencia dele no /zeus/root/home/squirrel/
e se esse for mais recente que seja copiado para
/home/squirrel.
E se existir algum arquivo que exista em
/zeus/root/home/squirrel, que nao existe em /home/squirrel, que
esse arquivo seja copiado para /home/squirrel.
Reinaldo






The information contained in this e-mail is confidential. It may also be legally
privileged. If you are not the addressee you may not copy, forward, disclose
or use any part of it. If you have received this message in error, please 
delete it
and all copies from your system and notify the sender immediately by return 
e-mail.
E-mail communications cannot be guaranteed to be timely secure, error or 
virus-free.
The sender does not accept liability for any errors or omissions which arise as 
a result.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]