jhs3 has asked for the wisdom of the Perl Monks concerning the following question:
I have been searching the archives and found a few similar questions...and answers. But, maybe some good monk can help me with this.
I want to be able to look at directory (a program source directory) and list the files with a changed date within a calendar month. I will tell the script which month and which directory. I then need to add the resulting file to a text file, checking if I had already put the file there for the same date: I would need to run the script daily, so the same file would likely already be in the text file. But, if a program source file has changed more than once within the month, I'd want to add another entry in the text file.
The code needs to work in both a Unix (HP / ksh) and Windows NT environment.
FYI: this is something being foist on me because of Sarbane-Oxley requirements. So this sort of search may already being used by someone else that is plagued by SOX.
(funny how SOX is a 4-letter word...)
Re: Directory listing for a date range
by Fletch (Bishop) on Jan 11, 2007 at 19:10 UTC
|
Most good SCM systems (Subversion, Perforce, et al) will keep this kind of information automagically and then it's just a matter of judicious parsing of the output from svn log or the like to produce a report. And you really should be using some form of SCM anyhow, so why bother with the record-keeping yourself?
And condolences on the SOX thing; I've felt and continue to feel said pain. %/
| [reply] [Watch: Dir/Any] |
Re: Directory listing for a date range - use a versioning system
by imp (Priest) on Jan 11, 2007 at 19:33 UTC
|
| [reply] [Watch: Dir/Any] |
Re: Directory listing for a date range
by jettero (Monsignor) on Jan 11, 2007 at 17:45 UTC
|
Without getting into specific implementation details; personally, I'd store a Digest::SHA1 hash along with a file size and date stamp in a file or database table. There is a risk of collisions, but it's probably pretty small if you also compare the file size.
To make sure it worked right even when there were no databases to connect to, I'd probably use DB_File or Storable. Even DBD::SQLite would be an excellent choice for that. I think it's largely a matter of preference, but if you like the look of Storable.pm, be sure to think about splitting it up by month and/or directory. Otherwise, reparsing that file into memory every time the program runs could get expensive.
Then, when you need to generate file change reports, you can just work off the simple database and you're done!
| [reply] [Watch: Dir/Any] |
OT: tripwire or aide to satisfy SOX.
by osunderdog (Deacon) on Jan 11, 2007 at 18:50 UTC
|
In the past, I've considered installing tripwire or aide (see google) so that I could prove that a sys admin had modified something on a production system without proper notification. These tools might be used to handle SOX requirements.
| [reply] [Watch: Dir/Any] |
|