Re: MUAs and timestamps, was Re: how to grep without changing timestamps?
On Fri, Jan 12, 2001 at 02:11:58PM +0000, David Wright wrote:
>
> (...)
>
> The idea that mutt should have to scan all my inboxes to determine
> whether I have new mail is bad enough; the idea that the inboxes
> should be rewritten (not even just appended to) would be crazy.
right, I'd definitely agree!
> The status quo is automatic (that's how timestamps work), lightweight
> and works. If you must grep your active inboxes, it seems a small price
> to pay to have to reapply the access timestamps.
a small wrapper script (in Perl -- I know one could do that in at least
25 other languages as well ;-) to restore timestamps after running some
program over a set of files might look something like:
#!/usr/bin/perl
while ($ARGV[$c] =~ /^-/) {$c++}; # find first 'non-option'
@files = @ARGV[++$c..$#ARGV]; # filelist begins after search-regex
# (extraction of filelist from commandline might need to be improved...)
# get atime/mtime for all files
foreach $f (@files) {
push @times, [(stat $f)[8,9], $f]; # 8: atime, 9: mtime
}
# run your favourite grep or whatever here:
system "grep @ARGV";
# restore atime/mtime for all files
foreach $f (@times) { utime @$f; }
You would call it more or less like grep. Assuming you name it mygrep:
mygrep [options] search-regex files...
Cheers,
Erdmut
--
Erdmut Pfeifer
science+computing gmbh
-- Bugs come in through open windows. Keep Windows shut! --
Reply to: