This is the mail archive of the
mailing list for the Cygwin project.
Re: Advice on where to look to solve a problem
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Tue, 08 Jul 2003 08:05:18 -0700
- Subject: Re: Advice on where to look to solve a problem
- Organization: My own little world...
- References: <email@example.com>
> 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.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html