Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3F0ADDAE.62AA803D@dessent.net> Date: Tue, 08 Jul 2003 08:05:18 -0700 From: Brian Dessent Organization: My own little world... X-Accept-Language: en,en-US MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Advice on where to look to solve a problem References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Steve wrote: > I need to make a script that will check all of the file modified dates > on all of the files in a list of directories. If any of these dates is > older then the current date I want to print the name of the file and the > date to a file. > > I'm new to bash scripting and many unix commands. What are the commands > that I want to loook at that could do these things for me? I think the find command should be able to do what you want. For example "find . -mtime +1" should give you a list of files that are older than 24 hours (based on modification date.) You didn't say exactly what you meant by "older than the current date" but you may also be able to use -daystart if you want files not modified today, rather than in the last 24 hours. For printing the names, you can use "-ls" to give a rather verbose listing, or append "| xargs ls -l" to get an "ls -l" listing for each find result... you may want to read the other thread about doing ls -l on find results, either add "-type f" or use "ls -ld" otherwise you'll list contents of directories rather then their names. You can also use "-printf" and specify whatever output format you want. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/