Page 1 of 1

Checking File Date

Posted: Tue Dec 31, 2019 12:29 pm
by Malbanese
Hello ~ I am trying to have a conditional statement that checks the data of a file and if it does not match the current system date to send me an email, otherwise the file gets SFTP to a vendor. I am having trouble with the syntax that checks the file date.

This is my "IF" condition:

${FileInfo('C:\Program Files\HelpSystems\GoAnywhere\userdata\webdocs\Temp\FULLUPBAL.CSV')}:lastModifiedDate < system.currentDate

Which throws this error:

[8046 - If: ${FileInfo('C:\Program Files\HelpSystems\Go...] Invalid condition syntax in attribute 'condition' of element 'if'. Unrecognizable character '}' found at position '87'.

Any help would be appreciated

Re: Checking File Date

Posted: Wed Jan 08, 2020 2:51 pm
by Support_Jake
Your syntax is off just a little bit, and also I think you may be missing a timestamp task in your project. I have attached my XML for your example but most importantly below is the string I ended up using (Please replace with your full file name as mine is just for testing).

IF Condition:
${FileInfo('C:\Users\jacob.przybysz\Desktop\MFT Testing\custsample.csv'):lastModifiedDate < TimestampNow}

Code: Select all
<project name="Check if File edited today" mainModule="Main" version="2.0" logLevel="verbose">

	<module name="Main">

		<print version="1.0">
			<![CDATA[${FileInfo('C:\Users\jacob.przybysz\Desktop\MFT Testing\custsample.csv'):lastModifiedDate}]]>

		<timestamp version="1.0">
			<format outputVariable="TimestampNow" />

		<if condition="${FileInfo(&apos;C:\Users\jacob.przybysz\Desktop\MFT Testing\custsample.csv&apos;):lastModifiedDate &lt;  TimestampNow}" disabled="false">

			<print version="1.0">
				<![CDATA[~~This was edited BEFORE the timestamp was taken~~]]>

			<exitProject version="1.0" />


		<print version="1.0">
			<![CDATA[***This was edited AFTER the timestamp was taken***]]>