encrypting files over 60 days old.

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
3 posts Page 1 of 1

ehersh

Posts: 56
Joined: Mon Sep 26, 2016 12:50 pm

Post by ehersh » Wed Nov 02, 2016 8:28 am
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>
Last edited by ehersh on Mon Jul 17, 2017 2:59 pm, edited 1 time in total.

Support_Rick

Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Wed Nov 02, 2016 8:47 am
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/">
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

ehersh

Posts: 56
Joined: Mon Sep 26, 2016 12:50 pm

Post by ehersh » Thu Nov 03, 2016 8:33 am
Thank you this is working now.
3 posts Page 1 of 1