Page 1 of 1

fileinfo with variable as filepath

Posted: Wed Jan 04, 2017 1:56 pm
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?

Re: fileinfo with variable as filepath

Posted: Wed Jan 04, 2017 4:35 pm
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!

Re: fileinfo with variable as filepath

Posted: Wed Jan 18, 2017 10:02 am
by ajdazeve
this worked thank you

Re: fileinfo with variable as filepath

Posted: Fri Feb 17, 2017 11:50 am
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 ?