Page 1 of 1

encrypting files over 60 days old.

Posted: Wed Nov 02, 2016 8:28 am
by ehersh
I am trying to encrypt files over 60 days old and move them to a different folder. Using a copy on a previous project I can do that. Is all I am doing is basically replacing the copy with the encrypt, the attributes are the same. The job is however encrypting all of the files regardless of the time stamp. When I run in debug the variable date is correct.
Code: Select all
project name="testPGPencryptesh" mainModule="Main" version="2.0" logLevel="debug">
	<description>pull files over 60 days old</description>
	<variable name="sixty_days" value="60" description="Files older than this will be moved" />

	<module name="Main">

		<timestamp version="1.0" disabled="false">
			<format outputVariable="date" pattern="yyyy-MM-dd" dayOfMonth="-${sixty_days}" />
			<format outputVariable="system.currentDate" pattern="yyyy-MM-dd" />
		</timestamp>


		<pgpEncrypt label="pgp encrypt" resourceId="PGP Key Ring" outputDir="<path to>\SFTPHome/EDI\Goanywhere_testing/Inbound/test/" whenFileExists="rename" processedInputFilesVariable="encrypted_files" version="1.0">
			<publicKey keyID="0x337F0E11AA164582" />
			<fileset dir="<path to>\test\Goanywhere_testing/Inbound/">
				<dateFilter>
					<exclude from="${system.currentDate}" to="${date}" />
				</dateFilter>
			</fileset>
		</pgpEncrypt>

	</module>

</project>

Re: encrypting files over 60 days old.

Posted: Wed Nov 02, 2016 8:47 am
by Support_Rick
You state that you want to only encrypt files older than 60 days .... that means "to" 60 days ago. Please review the documentation on each of the "From" and "To" options to further understand their usage.

To accommodate your need,

Change this:

<timestamp version="1.0" disabled="false">
<format outputVariable="date" pattern="yyyy-MM-dd" dayOfMonth="-${sixty_days}" />
<format outputVariable="system.currentDate" pattern="yyyy-MM-dd" />
</timestamp>

to this:

<timestamp version="1.0" disabled="false">
<format outputVariable="date" pattern="yyyy-MM-dd" dayOfMonth="-${sixty_days}" />
</timestamp>

Then change this:

<dateFilter>
<exclude from="${system.currentDate}" to="${date}" />
</dateFilter>

to this:

<dateFilter>
<exclude to="${date}" />
</dateFilter>

Also, you might want to check your file path ... you have / and \ entries

<fileset dir="<path to>/SFTPHome/EDI\Goanywhere_testing/Inbound/">

Re: encrypting files over 60 days old.

Posted: Thu Nov 03, 2016 8:33 am
by ehersh
Thank you this is working now.