On Tue, 13 Nov 2007 10:14:14 +0530, मनीष
<[EMAIL PROTECTED]> said:  

Ankit> >Can anyone tell me, how to get latest created file from a folder
Ankit> >to be used in shell script?

Bimal> you may also take a look at "find" command with "time"
> parameter, see "man find" for more details.

> You mean -mtime, -atime and -ctime options?  But this will also not
> give latest `created' file.  Let's hear from Ankit if he found what he
> was looking for.

        Hmm.
 % cd $dir
 % ls -last | head -n 3

        Seems to work for me. If you want the output to be easier to
 parse, and to ignore . and .., use:
 % ls -t | head -n 1

        manoj
-- 
You can drive a horse to water, but a pencil must be lead.
Manoj Srivastava <[EMAIL PROTECTED]> <http://www.golden-gryphon.com/>  
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C


_______________________________________________
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22/23, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/

Reply via email to