On Sat, Jun 21, 2014 at 7:11 AM, Jonathan Sheehan < [email protected]> wrote:
> On Sat, Jun 21, 2014 at 12:48 AM, Paul Boniol <[email protected]> > wrote: > > I need to do a fairly complex search and replace across an entire site's > > files. > > > > Find files ending in certain extensions (over 1,700 files) > > Exclude files in certain directories > > Search contents of matching files for a certain pattern. If found, > rewrite > > the file replacing the pattern.. > > Preserve the file modification date on modified files. > > Heh- if I didn't know you, I'd say it sounds sketchy: > 1) Back-date records. > 2) Get caught in massive money-laundering scheme. > 3) Profit!!! ;-) > > Something wrong with my meme... Anyway: > > > While I was able to do most of this on the command line in Linux (find, > > grep, sed), preserving the modification date on the files didn't appear > to > > be an option. > > You can stat the file to get the mdate, and then use touch at the end > to re-set it. > > > (Also it removed write permission on the files... Easily fixed, but > just odd.) > > Definitely weird. You checked your current umask? There is a change in the language our site uses. We have frequently used a parameter that specified the default value. The language removed the parameter in the latest version. When (if?) we upgrade the server to the new version, our site will be badly broken. We've know it has been deprecated, and have removed it when we were editing a file (and remembered), but probably 90%+ of the pages will be broken. Preserving the dates on the files just makes life easier. Seeing that almost every file on the system will have almost the exact same modification time, it isn't helpful in finding when a "real" change was done, or determining which version of a page is more current (or how old). But yes, I can see that capability could be used for something bad. Of course after I clicked send I thought of umask but hadn't checked till just now. Yes, it somehow got set funky. Think I'm about done with a Perl program to do it. Still seems like there ought to be a module. lol :) Paul -- -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en --- You received this message because you are subscribed to the Google Groups "NLUG" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
