I am trying to check if a given file exists in one of the directories listed in the parent of parent of current directory (2 levels up)
isFileName(ruleFile list("..." ) )
This doesnt seem to be correct.
Could you please suggest a solution for the same. Is there an alternate to varying the SKILL Path?
See if this works for you. Just replace filename.txt with your filename.
In reply to Randy R:
Thanks for the suggestion!
But it is not working as expected.
In general, how is a file searched in multiple/hierarchy of directories in SKILL?
In reply to BinduSripad:
The suggestion by Randy R actually works. Alternatively,if you have defined path to search.. you can use the isFile(filepath) command.
For file multiple file searching, you may use getDirFiles then loop.
In reply to Aldrin:
*For multiple directory/hierarchy searching, you may use getDirFIles then loop on the result.
This works :
;; you can change the directory depth based on requirement
_fileList = getDirFiles("../../../")
if( exists(_file _fileList (stringp _file))
_checkFile = "True"
printf("\nFile %s not found!" _file)
Thanks for the helpful pointers!!
You may want to try axlDMFindFile which ignores the skillPath variable. For examle to find a file up 2 levels do
sprintf(buf "../../%s" ruleFile)
result = axlDMFindFile("MISC" buf "r")
if result is nil then file does not exist.
It is also best to use UNIX style directory delimiters ( "/") instead of Windows style ("\") since you don't need escape the UNIX version.
In general, getDirFiles should be avoided if performance will be an issue.