fileinfo with variable as filepath
Posted: Wed Jan 04, 2017 1:56 pm
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?
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?