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

Re: ¿O.T? Bash Scripting



Hola.

A ver si esto te vale:

find . -name "/var/proyectos/*" | grep -v .gz |
while read each; do
   echo $each
   if [ -f $each ]; then
      gzip -9f "$each"
   fi
done

No lo he probado, pero seguro que tira, jejejeje.
Espero que te sirva.

Un saludo.


On Wed, 2005-01-19 at 16:24 +0100, Txente wrote:
> No se si es Off topic, si es asi ignorad el mensaje y mis disculpas por 
> adelantado.
> 
> 
> Prentedo comprimir con Gzip todos los archivos que cuelgan de un 
> determinado direrctorio (/var/proyectos) y para ello he ido averiguando 
> un script...
> ===========================================================
> for each in $(find /var/proyectos/* | grep -v .gz);
> do
>    if [ -f $each ]
>    then
>       echo $each
>       gzip -9f $each
>    fi
> done;
> ===========================================================
> 
> 
> Tienen que estar los ficheros uno a uno, no puedo hacer un tar de los 
> directorios, ni inventos. El problema viene con los ficheros con nombre 
> largo y que tienen espacio dentro del mismo ("Mi Documento.doc", por 
> ejemplo). No se exactamente que pasa, pero lo que es obvio es que no me 
> los comprime :-(
> 
> Cualquier idea/sugerencia sera bien recibida. Ah! no, no puedo renombrar 
> los nombres... :-)
> 
> 
-- 
Guillermo Rial Pinedo.

Getronics Iberia
C/ Miguel Yuste, 45
28037 Madrid
Spain
Tel: +34 91 325 3300
Fax: +34 91 754 5077
guillermo.rial@getronics.com
www.getronics.es

The infromation transmitted is intended only for use by the addressee
and may contain confidential and/or privileged material. Any review,
re-transmission, dissemination or other use of it, or the taking of any
action in reliance upon this information by persons and/or entities
other than the intended recipient is prohibited. If you received this in
error, please inform the sender and/or addressee immediately and delete
the material.

Thank you.

----------

Clave Pública GPG - GPG Public key:
http://www.rediris.es/cert/servicios/keyserver/

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: