El Friday, 30 de June de 2006 00:55, Sebastian Bassi escribió:
> Tengo que comprimir muchos archivos, que estan dentro del dir
> listaarchivos en un tgz (o lo que sea, pero tienen que estar todos
> juntos).
> Entonces hice:
> tar -czvf miarchivo.tgz listaarchivos/*
El tar de GNU no necestia el "*", prueba en poner
tar -zcvf archivo.tar.gz directorio/
O si es el directorio actual:
tar -zcvf ../archivo.tar.gz ./
> Pero me daba el error:
> /usr/bin/tar: Argument list too long
> Eso es porque el asterisco al expandirse en el shell crea un lista
> mas grande que el buffer del shell (porque hay muchos archivos en
> ese dir, varios miles).
> Entonces, para seguir con mi trabajo hice esto:
> tar -czvf miarchivo.tgz listaarchivos
> Esto es, comprimi el directorio padre de mis archivos, que por
> supuesto incluye a mi archivos y con eso safe y puedo seguir
> haciendo lo que necesitaba.
> PERO, ahora tengo la duda de como resolver esa situacion SIN
> recurrir al directorio padre, quiero saberlo solo por curiosidad,
> no porque lo necesite, porque como les dije, con lo que hice antes
Si quieres hacer todo en el mismo directorio (cosa que para mi no es
tan recomendable, pero bue), puedes hacer:
tar -cvf archivo.tar primer_archivo
Y luego:
fun() { tar -ucvf archivo.tar $1 && rm $1; }
ls -1|grep -v archivo.tar|xargs -iO fun() O
>
> The problem shows up in areas where we would not have expected it.
> Try removing 5000 files that match *.old
> rm *.old fails.
> Or try moving 5000 files that match *.dat
> I've had to resort to multiple pipes to get the job done that
> should work with a single command.
> ls | grep dat$ |awk '{ print "mv " $0 " /home/mydir/dat_files" }' |
> sh is a long way around what should be:
> mv *.dat /home/mydir/dat_files
> And I'll bet it isn't as efficient.
> Production scripts that have worked for years are now failing due
> to reaching that magic number of files.
> I just wish there were a global solution - like setting a system
> parameter - that would solve it.
>
> Que tal?
Sip, es lo que usualmente yo tengo que hacer para mover/borrar o
trabajar de alguna forma con más de 5k archivos.
--
Atentamente, yo <Matías>
Y sin fumar desde (casi) el '1089515700'
http://www.nnss.d7.be
Let one walk alone, commit no sin,
with few wishes, like an elephant in the forest
--
Para desuscribirte tenés que visitar la página
https://listas.linux.org.ar/mailman/listinfo/lugar-gral/
/* Publica y encontra trabajo relacionado con softlibre en
http://www.usla.org.ar/modules/jobs/ */
Si tenés algún inconveniente o consulta escribí a mailto:[EMAIL PROTECTED]