Modification Date Blues
Modification Date Blues
- Subject: Modification Date Blues
- From: SeaSoft Systems <email@hidden>
- Date: Tue, 14 Nov 2000 07:45:34 -0800
I am working on a simple AS to process log files by stripping out
certain unwanted lines.
My problem is that sometimes the modification date of a processed
file is updated by the script, and sometimes not.
I have been unable to detect a pattern to this. I would think that
any "close access" to a file that had been written to would cause the
modification date to be reset, yet this does not always happen, at
least on my system (OS 8.6). Could anyone shed some light on this
behavior?
The script is used as a folder attachment and utilizes Leanord
Rosenthal's wonderful RegExp osax.
Stripped to bare essentials, the script is:
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
set destFldr to (this_folder as text) & "Processed Logs:"
set the item_count to the number of items in the added_items
repeat with i from 1 to item_count
set FileItem to item i of the added_items
set theFile to FileItem as text
read theFile until eof
set theText to the result
close access theFile
REMatchLines theText pattern
"((^.*192.168.167..*$)|(^.*uptime.html.*$))" with inverse
set theText to the result
set eof theFile to 0
write theText to theFile starting at 0
close access theFile
move file theFile to folder destFldr
end repeat
end tell
on error errMsg number errNum
display dialog "error number " & errNum & ": " & errMsg
end try
end adding folder items to
Any thoughts much appreciated,
Richard Hartman