LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-20-2013, 03:14 AM   #1
Sudharshana
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Rep: Reputation: Disabled
Red face How to pick up a file that has been created latest ?


I have a list of files in my directory with the extension *.ksh.ATC.cs . I need to get the last created file of these and copy it to a different location. How can I do this?
 
Old 02-20-2013, 03:35 AM   #2
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 273Reputation: 273Reputation: 273
Try with:

Code:
cp `ls -ltr *.ksh.ATC.cs | tail -1 | awk '{print $9}'` /yournewfolder
 
3 members found this post helpful.
Old 02-20-2013, 03:42 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 2,955

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
Note: creation time is not stored, if last modification time is okay, use 'ls -1tr | tail -n1'
 
Old 02-20-2013, 04:51 AM   #4
Sudharshana
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks a ton kooru, it worked!!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
sort files inside a directory and sub-directories by latest created walidaly Linux - Software 8 07-25-2009 03:45 PM
latest update patch created wifi connection problems mel1000 Linux - Newbie 1 04-17-2009 11:57 AM
how to pick random file name from a list of filenames in a text file. pdklinux79 Linux - Newbie 9 06-20-2008 03:46 PM
I need to pick out the first, last and how many from a file...?!!? vous Programming 3 03-22-2005 02:44 PM
How to pick a string from a text file? sdandeker Linux - General 1 02-12-2004 05:17 AM


All times are GMT -5. The time now is 01:02 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration