Re: Find and append file path

2017-01-12 Thread Tim Chase
On 2017-01-12 18:32, Peter Otten wrote: > Why did you add an explicit isdir() check? My understanding is that > the names in dirs are known to be directories. Ah, right. The code I had laying around that did something similar but processes both the dirs and the files, so when the OP asked for jus

Re: Find and append file path

2017-01-12 Thread Peter Otten
Tim Chase wrote: > def dir_iter(root): > for fullpath in ( > os.path.join(path, dir_) > for path, dirs, files in os.walk(root) > for dir_ in dirs > ): > if os.path.isdir(fullpath): > yield fullpath Why did you add an explicit

Re: Find and append file path

2017-01-12 Thread Tim Chase
On 2017-01-12 19:28, Iranna Mathapati wrote: > Example: > CLI Input: /root/user/branches/xyz > > find latest file and append to CLI path: > "/root/user/branches/xyz/Apple" I've used something like the below to find the most recent file in a directory tree (it also works for pulling other attribu

Re: Find and append file path

2017-01-12 Thread Rhodri James
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 and append file path

2017-01-12 Thread Iranna Mathapati
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: "/ro