[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: delete n files in a directory



=?iso-8859-1?Q?M=E1rio?= Henrique Cruz =?iso-8859-1?Q?T=F4rres?= 
	<mario@mitus.com.br> wrote:
>    Good morning everyone. I wan't know if can I delete the first 200
>files ( in alphabetical order ) in a directory wich have
>300 files ?

  ls -1 | head -200 | xargs rm

Be careful, though. Look at what 'ls -1 | head -200' outputs before
piping that to rm.

>    I'm using bash shell.

Exactly which shell you're using shouldn't matter for the above.

Cheers,

-- 
Colin Watson                                     [cjw44@flatline.org.uk]



Reply to: