Re: Need help writing a script
From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 10/25/04
- Next message: William Park: "Re: [FUN] Algorythms and colors."
- Previous message: Seb: "Re: Need help writing a script"
- In reply to: ray: "Need help writing a script"
- Next in thread: Michael Tosch: "Re: Need help writing a script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Oct 2004 00:52:34 GMT
On 2004-10-24, ray wrote:
> This is a multi-part message in MIME format.
Please do not post HTML to Usenet.
> I am trying to write a script that reads the files in a directory and =
> prints the name of the files that are older than days or the size is =
> more than 10MB. I know I have to use ls -l and pipe it to grep, but =
> don't know how to compare date or size.
You need "find", not "ls":
days=666 ## adjust to taste
big=+10000000c
dir= ## whatever
find ${dir:-.} \( -mtime +$days -o -size $big \) -print
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
===================================================================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
- Next message: William Park: "Re: [FUN] Algorythms and colors."
- Previous message: Seb: "Re: Need help writing a script"
- In reply to: ray: "Need help writing a script"
- Next in thread: Michael Tosch: "Re: Need help writing a script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|