← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #172484]: HOW TO: file with extension exists

 

Question #172484 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/172484

    Status: Open => Answered

RaiMan proposed the following answer:
--- a how to --- quick and dirty

import os
dir = "absolute-path-to-your-folder"
files = os.listdir(dir)
for f in files:
    full = os.path.join(dir, f)
    if not os.path.isfile(full): continue
    if not f.endswith(".clm"): continue
    break
print f # this is your file

more information:
http://www.jython.org/docs/library/os.html#files-and-directories
http://www.jython.org/docs/library/os.path.html

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.