What you curently have will issue ls -lt for each file individually as it is listed by find, so all you will get is the list in whatever order find gives them to you. Using ls -lrt will probably have no effect in what you already have.
Could I suggest:
Note the quotes as otherwise the * will get expanded and may blow your command length limit. You might even find that "more than one" file listed in this way will be invalid to find anyway.
This will find all the files and then pass that list through xargs to an ls -lrt. It's not perfect as there is a limit to xargs, but you will have to see you man pages for that and also experiment a little.
Are we to assume that the XXXX is a time? If so, could that be forced to the end of the filename? If so, then, chronologically speaking, the most significant digits are first, i.e. CCYYMMYY_HHmm.gz ...If you can, then it is a simple sort based on the filename, e.g.:
...will give the largest number/newest file last.
I hope that these suggestions help, but please feel free to write again if I have missed the point completely.
Robin,
Liverpool/Blackburn
UK
Last edited by rbatte1; 11-30-2011 at 08:54 AM..
Reason: Spelling
Hi,
I am new to Unix shell scripting. Can you please help me with this immediate requirement to code.. The requirement is as given below.
In a directory say Y, I have files like this.
PP_100000_28062006_122731_746.dat
PP_100000_28062006_122731_745.dat
PP_100000_28062006_122734_745.dat... (4 Replies)
Hi Gurus, Experts,
I am facing a problem to concatenate all the files based on timeStamps.
The Problem is like this .
The are many files in a folder Which are of the below types
Ack_to_MDS_20070809141159.xml
Ack_to_MDS_20070809141157.xml
Ack_to_MDS_20070809141155.xml... (19 Replies)
Hi,
I am trying to write a script to ftp and get all the files between two date/time stamps from a archive directory. I have sent an attatchment of my archive directory. With the script I intend to get files for ex: between request.log.2008-08-22-03-53-49.gz &... (3 Replies)
find / -type f 2> /dev/null | find -inum +1 2> /dev/null | find -mtime -30 2> /dev/null
what i am trying to do i search all regular files in root directory with one or more
inodes modified within last 30 days.
the /dev/null is to suppress the permission denied outputs.
i am now trying to... (5 Replies)
Hi, I have a bunch of media files in a directory that have been converted (from MTS to MOV format), so my directory contains something like this:
clip1.mts
clip1.mov
clip2.mts
clip2.mov
The problem is that the .mov files that have been created have the timestamps of the conversion task,... (2 Replies)
I have the following set of files and I want to order them according to the ascending values of the run:
For example, doing
ls -lrt *drw*.log
gives
n02-z30-sr65-rgdt0p25-dc0p08-4x3drw.log
n02-z30-sr65-rgdt0p25-dc0p03-8x6drw.log
n02-z30-sr65-rgdt0p25-dc0p01-8x6drw.log
... (18 Replies)
Hi,
Im trying to write a script to first check a directory and if the filename has "ACK" in it do nothing and exit but if it has "ORD" in the filename then compare it with a dummy file created 2 minutes previous and see which one is newer
Im getting a few errors which im unsure how to rectofy... (5 Replies)
OK.
if the first file is :
3184 2014-07-28 04:15 global.Remote-Access 10.111.8.25 81.245.6.25 tcp 3268
3035 2014-07-28 04:16 global.Remote-Access 10.111.8.12 81.245.6.25 tcp 3268If the second file is:
1 Jul 28 04:12 2014-07-28 id967254(BGC-TLW-Cert) Tunneling: User with IP... (8 Replies)