Skip to content

fileinfo with variable as filepath

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
  • ajdazeve Offline
  • Posts: 5
  • Joined: Wed Jan 04, 2017 1:05 pm

fileinfo with variable as filepath

Post by ajdazeve »

Hi there,
I am trying to build an if condition to find out if a file exists. However the filepath is contained in a variable . In this case variable name = item
Now I am trying the following
${FileInfo('"${item}"'):exists}
I tried with simple ,double quote… it tries to find item not the actual content of the variable.
To put a bigger picture on the project… here is what it will does.
Project gets file list from a folder…. Then goes into a loop
sends each file to an icap server for scanning..
if there’s a virus it deletes the whole folder ….( we don’t want any of the content if a virus is found).
Then it goes back in the loop grabs the next file.
Now this work very well if a virus is the last file in the list. Elsewhere since I deleted the folder the next icap request is with and empty file … that return an error code that is the same as if the antivirus dosent responds. In order to avoid unnecessary calls and false positive I want to put a if condition
Just before calling the antivirus module… verify if the file exists… if so …. Go if not next file.
Any ideas?
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: fileinfo with variable as filepath

Post by Support_Rick »

The parameter for the FileInfo command has to be a STRING. Thus,

${ FileInfo(String( item ) ):exists }

Should get you what you're looking for!
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • ajdazeve Offline
  • Posts: 5
  • Joined: Wed Jan 04, 2017 1:05 pm

Re: fileinfo with variable as filepath

Post by ajdazeve »

this worked thank you
  • ajdazeve Offline
  • Posts: 5
  • Joined: Wed Jan 04, 2017 1:05 pm

Re: fileinfo with variable as filepath

Post by ajdazeve »

hi its me again this syntax worked well

${ FileInfo(String( item) ):exists }
however i woudl like to validate a folder the full path is in 2 different variables.
now since i have to add the / mft is trying to divide both variables
i tried like this dosent work
${ FileInfo(String('${path}/${cleanName}') ):exists }

how should i do this ?
Post Reply