Ant zip files and keep root directory

An example of using apache Ant to create a zip file and keep the root directory.

<target name="package" depends="compile">
    <tstamp>
        <format property="ts" pattern="yyyyMMddhhmmss"></format>
    </tstamp>

    <property name="zipfolder" value="projectname-${ts}"></property>

    <mkdir dir="${zipfolder}"></mkdir>

    <copy todir="${zipfolder}">
        <fileset dir="${basedir}" includes="folderX/**, fileX"></fileset>
    </copy>

    <zip destfile="${zipfolder}.zip">
        <zipfileset dir="${basedir}">
            <include name="${zipfolder}/**/**"></include>
        </zipfileset>
    </zip>

    <delete dir="${zipfolder}"></delete>
</target>

automation ant