Created
February 14, 2011 20:27
-
-
Save millermedeiros/826481 to your computer and use it in GitHub Desktop.
Example Ant task to copy/delete folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<project name="example-purge-copy" default="" basedir="."> | |
<!-- properties --> | |
<!-- make sure you are pointing to the right folder since purgeDeploy can delete undesired files... --> | |
<property name="deploy.dir" value="../../deploy" /> | |
<!-- custom tasks --> | |
<!-- targets --> | |
<target name="-mkdirs" description="Make required dirs."> | |
<echo message="Creating required directories..."/> | |
<mkdir dir="${deploy.dir}"/> | |
</target> | |
<target name="purgeDeploy" description="Delete old deploy files."> | |
<echo message="Deleting old deploy files..."/> | |
<delete includeEmptyDirs="true"> | |
<fileset dir="${deploy.dir}"> | |
<include name="**" /> | |
<exclude name="**/.svn" /> <!-- skip .svn folders otherwise it will cause SVN conflicts --> | |
</fileset> | |
</delete> | |
<antcall target="-mkdirs"/> | |
</target> | |
<target name="copyToDeploy" description="Copy files to deploy folder."> | |
<copy todir="${deploy.dir}"> | |
<fileset dir="${basedir}"> | |
<include name="**" /> | |
<exclude name="**/_*/**" /> <!-- ignore files/folders starting with underscore --> | |
<exclude name="**/.svn" /> | |
<exclude name="**/.git" /> | |
<exclude name="**/.hg" /> | |
<exclude name="**/.DS_Store" /> | |
<exclude name="**/.tmp*" /> | |
<exclude name="**/.project" /> | |
<exclude name="**/.livereload" /> | |
<exclude name="**/.jshintrc" /> | |
<exclude name="**/.settings/**" /> | |
<exclude name="build.xml" /> | |
</fileset> | |
</copy> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've created a similar script using node.js. See Gist 2640642