ubuntu – Comprima todo en el directorio actual

Pregunta:

Me gustaría comprimir y empaquetar todo, incluidos los archivos y carpetas en el directorio actual, en un solo archivo ZIP en Ubuntu.

¿Cuál sería el comando más conveniente para esto (y el nombre de la herramienta que se debe instalar, si corresponde)?

Editar: ¿Qué sucede si necesito excluir una carpeta o varios archivos?

Respuesta:

Instale zip y use

zip -r foo.zip .

Puede usar los indicadores -0 (ninguno) a -9 (mejor) para cambiar la tasa de compresión

La exclusión de archivos se puede realizar mediante el indicador -x . Desde la página de manual:

-x files
--exclude files
          Explicitly exclude the specified files, as in:

                 zip -r foo foo -x \*.o

          which  will  include the contents of foo in foo.zip while excluding all the files that end in .o.  The backslash avoids the shell filename substitution, so that the name matching
          is performed by zip at all directory levels.

          Also possible:

                 zip -r foo foo -x@exclude.lst

          which will include the contents of foo in foo.zip while excluding all the files that match the patterns in the file exclude.lst.

          The long option forms of the above are

                 zip -r foo foo --exclude \*.o

          and

                 zip -r foo foo --exclude @exclude.lst

          Multiple patterns can be specified, as in:

                 zip -r foo foo -x \*.o \*.c

          If there is no space between -x and the pattern, just one value is assumed (no list):

                 zip -r foo foo -x\*.o

          See -i for more on include and exclude.

Leave a Comment

Your email address will not be published. Required fields are marked *

web tasarım