↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

Excluding directories from zip files on Linux

The post describes a need to package source code in zip files while leaving out files and directories that should not be distributed. The examples given are Mercurial’s .hg folder and NetBeans-specific project files and folders.

It says File Roller can create archives easily, but it does not provide an easy way to exclude directories. The solution is to use the command-line zip utility with the -x switch and list the paths to omit.

Reading notes
#

  • Source code is often turned in as zip files.
  • The project uses plain ANT build files and is loaded into NetBeans as a free form project.
  • NetBeans creates its own folders and files for the project.
  • Mercurial creates an .hg folder that should not be distributed.
  • File Roller is used on Linux to create zip files.
  • File Roller does not easily exclude files or directories from the archive.
  • Deleting unwanted directories after archiving leaves the directory entry in the zip file.
  • The command-line zip utility can exclude files and directories with the -x switch.
  • The example command zips a directory while excluding .hg, nbproject, and catalog.xml.