LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 02: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, 02:35 AM   #2
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 275Reputation: 275Reputation: 275
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, 02:42 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

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

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


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:09 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
Open Source Consulting | Domain Registration