I'm running an Ant zip task to zip the whole contents of a directory on Unix systems:
<zip destfile="${deploy}/test.zip">
<zipfileset dir="/home/mydir" />
</zip>
After the zip is created, and checking the contents, I can see that some config files, Visual Studio specific files and others like the Mac OS .DS_STORE file are left out the zip.
Is there any rule ant follows to decide what files will not be included?
I need to know in advance since I need to create a list of existing files on that directory before zipping (currently using Java). Right now I'm excluding all directories and hidden files (using File.isHidden() and isDirectory() methods) , but the list is still getting some of the file Ant lefts out (for example, vssver.scc
Try this:
<defaultexcludes echo="true"/>
http://ant.apache.org/manual/Tasks/defaultexcludes.html
Note that this is used across all Ant taks that use filesets, not just the zip task.
From the docs, or use Konstantin's solution to inspect your particular installation:
There are a set of definitions that
are excluded by default from all
directory-based tasks. As of Ant 1.8.1
they are:
**/*~
**/#*#
**/.#*
**/%*%
**/._*
**/CVS
**/CVS/**
**/.cvsignore
**/SCCS
**/SCCS/**
**/vssver.scc
**/.svn
**/.svn/**
**/.DS_Store
Ant 1.8.2 adds the folllowing default
excludes:
**/.git
**/.git/**
**/.gitattributes
**/.gitignore
**/.gitmodules
**/.hg
**/.hg/**
**/.hgignore
**/.hgsub
**/.hgsubstate
**/.hgtags
**/.bzr
**/.bzr/**
**/.bzrignore
Excelent Ant Zip Task Reference is here: http://ant.apache.org/manual/Tasks/zip.html