Re: OT: Alternatives to ls for sorting files by modification time
Hi Tom!
Thanks for your quick reply!
On Wed, 25 Sep 2002, Tom Cook wrote:
> [...]
> All I can say is... it works for me. How many files in the directory
> where you're having this fail? It works for me in /usr/lib.
>
> # ls /usr/lib -lt1 | wc -l
> 841
I suspect the problem is not $NUM_OF_FILES since that is set to only
50. To me, the problem seems to be the sheer number of files returned by
ls:
ls -lt1 $BACKUP_DIR/*.arc | wc -l
2708
That number will grow considerably since these .arc files are Oracle
archive files and 4-5 of these files are created *per minute*.
> [...]
> otherwise you will get a lot of files with names like '-rw-r-----'
> that rm can't delete for some mysterious reason. Maybe that was your
> problem?
No, I don't get the permission settings since I used "ls -lt1" which is
different from "ls -lt". When it comes to "ls -lt", I absolutely agree
with you. Even though the ls's man page is not very specific on "-1", it
seems to strip the other info returned by "-l" away, which is what I want.
The awk you added of course also works, if I only used "ls -lt".
Thanks for your suggestion!
Greetings,
Holger
Reply to: