LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-02-2005, 02:32 PM   #1
toddcurry
LQ Newbie
 
Registered: Jun 2004
Location: Chicago
Distribution: FC2
Posts: 11

Rep: Reputation: 0
how to grab most recent directory


I'm working on a shell script, and I'm trying to find a way to grab the most recently-created directory name.

Visually, from the shell, it is the last item in: ls -lsrt

But I've googled for 2 hours now to find a way to do it programmatically... so if the script gods can show a little mercy... I'd be grateful.

Thanks,

TC
 
Old 05-02-2005, 03:03 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Just the same
ls -1tr | tail -n 1


Cheers,
Tink
 
Old 05-02-2005, 10:33 PM   #3
toddcurry
LQ Newbie
 
Registered: Jun 2004
Location: Chicago
Distribution: FC2
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Tinkster
Just the same
ls -1tr | tail -n 1


Cheers,
Tink
Beautiful -- thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab OS in PHP??? bfloeagle Programming 1 06-05-2004 06:37 PM
Need to grab bookmarks from IE... slackMeUp Linux - Software 3 01-25-2004 05:02 PM
Grab Cert?? joseph_1970 Linux - General 6 12-17-2003 09:39 AM
Cant grab files from my other computer? Lason Linux - Networking 3 11-06-2003 10:42 PM
xv grab garbage kramtoad Linux - Software 0 08-23-2003 07:26 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration