On 12/01/17 13:58, Iranna Mathapati wrote:
Hi Team,

How to append file path and find the latest folder according to the latest
date:

CLI input :"/root/user/branches/xyz"

i want to find latest file within CLI input path and append to given CLI
path

Example:
CLI Input: /root/user/branches/xyz

find latest file and append to CLI path:
"/root/user/branches/xyz/Apple"


Use os.scandir() to list whatever is in the directory, DirEntry.is_dir() will tell you if an entry is itself a directory, and DirEntry.stat() will let you get at the directory's various time stats. Which attribute you want depends on exactly what you mean by "the latest folder according to the latest date". Then just use your favourite means to join the directory name you selected to the original path.

--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to