Page 1 of 1

Delete processed directories

Posted: Thu Jul 31, 2014 7:40 am
by Cnile31
Hello,

I have a job that recursively archives files placed in directory X to directory Y within a zip file. After archiving the files to directory Y, the files are removed from directory X.

For some reason, the processed files are deleted from directory X, but the processed directories are not being deleted. Is it possible to also delete the, now empty, directories?

Thanks in advance.



Here is my current code:
Code: Select all
<project name="Job" mainModule="Main" version="2.0">

	<module name="Main" onError="abort">

		<timestamp version="1.0">
			<format outputVariable="Date" pattern="yyyy-MM-dd" />
		</timestamp>


		<createWorkspace label="createWorkspace" version="1.0" />


		<copy destDir="${system.job.workspace}" whenFileExists="rename" processedSourceFilesVariable="processed" version="1.0">
			<fileset dir="X" recursive="true" />
		</copy>


		<delete inputFilesVariable="${processed}" version="1.0" />


		<zip outputFile="Archive_${Date}.zip" whenFileExists="rename" version="1.0">
			<fileset dir="${system.job.workspace}" recursive="true" />
		</zip>


		<copy destDir="Y" whenFileExists="rename" version="1.0">
			<fileset dir="${system.job.workspace}" recursive="false">
				<wildcardFilter>
					<include pattern="*.zip" caseSensitive="false" />
				</wildcardFilter>
			</fileset>
		</copy>


		<deleteWorkspace version="1.0" />

	</module>

	<description>Archive Job</description>
</project>

Re: Delete processed directories

Posted: Thu Jul 31, 2014 11:05 am
by Support_Rick
Since you have the directory you are processing (recursively), then just issuing the Delete Task (and identifying the Parent Directory (X) that you're wanting removed will remove it plus any child directories within that Parent location. It will also remove all files from those folders as well.