Thread: off-topic - list files on linux

off-topic - list files on linux

From
"A.Burbello"
Date:
Hi people,

just a rapid question related to linux
How can I get the files in a directory, but not the
last file updated/created?

I could get the last file updated with:
ls -t1p  | grep -v / | grep -v backup | head -1

How can I get the inverse list, other files without
the last??

Thank you in advance.


      Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!
http://br.mail.yahoo.com/


Re: off-topic - list files on linux

From
Achilleas Mantzios
Date:
Στις Friday 28 March 2008 14:39:53 ο/η A.Burbello έγραψε:
> ls -t1p  | grep -v / | grep -v backup | head -1

maybe:
ls -t1p | grep -v / | grep -v backup | grep -v `ls -t1p | grep -v / | grep -v backup | head -1`

--
Achilleas Mantzios

Re: off-topic - list files on linux

From
Achilleas Mantzios
Date:
Στις Friday 28 March 2008 14:39:53 ο/η A.Burbello έγραψε:
> ls -t1p  | grep -v / | grep -v backup | head -1

maybe:
ls -t1p | grep -v / | grep -v backup | grep -v `ls -t1p | grep -v / | grep -v backup | head -1`

--
Achilleas Mantzios

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: off-topic - list files on linux

From
salman
Date:

Achilleas Mantzios wrote:
> Στις Friday 28 March 2008 14:39:53 ο/η A.Burbello έγραψε:
>> ls -t1p  | grep -v / | grep -v backup | head -1
>
> maybe:
> ls -t1p | grep -v / | grep -v backup | grep -v `ls -t1p | grep -v / | grep -v backup | head -1`
>

1) the -e flag for grep can be used to group strings so you don't have
to pipe multiple times (eg: grep -i -e bleh -e bleh2 -e bleh3 -ve backup)

2) wouldn't find be easier to use? find . -maxdepth 1 -type -f -print

-salman

Re: off-topic - list files on linux

From
hubert depesz lubaczewski
Date:
On Fri, Mar 28, 2008 at 09:39:53AM -0300, A.Burbello wrote:
> How can I get the files in a directory, but not the
> last file updated/created?
> I could get the last file updated with:
> ls -t1p  | grep -v / | grep -v backup | head -1
> How can I get the inverse list, other files without
> the last??

ls -t1p | grep -v / | grep -v backup | tac | tail -n +2

depesz

--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA.  here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)

Re: off-topic - list files on linux

From
Achilleas Mantzios
Date:
Στις Friday 28 March 2008 19:38:02 ο/η salman έγραψε:
>
> Achilleas Mantzios wrote:
> > Στις Friday 28 March 2008 14:39:53 ο/η A.Burbello έγραψε:
> >> ls -t1p  | grep -v / | grep -v backup | head -1
> >
> > maybe:
> > ls -t1p | grep -v / | grep -v backup | grep -v `ls -t1p | grep -v / | grep -v backup | head -1`
> >
>
> 1) the -e flag for grep can be used to group strings so you don't have
> to pipe multiple times (eg: grep -i -e bleh -e bleh2 -e bleh3 -ve backup)
>
> 2) wouldn't find be easier to use? find . -maxdepth 1 -type -f -print
>
I tried to give an example, using *only* primitives that already existed in the original question.
> -salman
>



--
Achilleas Mantzios