← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #166235]: about auto-search in a folder

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Since Sikuli talks Python, such things can be done much easier:

import os
dir = "absolute-path-to-your-folder"
files = os.listdir(dir)
latest = 0
file = ""
for f in files:
    full = os.path.join(dir, f)
    info = os.stat(full)
    t = time.strftime("%Y-%m-%d", time.localtime(info.st_ctime))
    if t > latest: 
        latest = t
        file = full
print file, latest # here you have your file

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