Re: Ken's grep question about renaming files to lowercase

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 52602
interpreted = N
texte = Ken, Can't you have webdna do this not on the fly but by replacing files recursively using writefiles? i agree that on the fly is problematic. Bill Kenneth Grome wrote: > To: (WebDNA Talk) > Date: Wed, 3 Sep 2003 01:18:14 +0800 > From: Kenneth Grome > Subject: Re: Ken's grep question about renaming files to lowercase > >> Ken, >> >> Speaking of unanswered questions, I think I have a partial solution >> to grepping your file names, however, I think you'd have to use an >> Applescript to do this in BBEdit because grep alone can't perform a >> change case function easily to a matched string. If anyone else >> knows otherwise, please let me know. This is the logic (working >> syntax will vary) for how I'd approach it in WebDNA: >> >> 1. Match a filename using a regular expression such as >> ([0-9A-Za-z]+)\.(tpl|htm|html|dna|gif|jpg|png) You could turn off >> case sensitivity in WebDNA 5.0 so you wouldn't need to consider >> permutations of lower/uppercase characters. This assumes all file >> names are alphabetical or numerical characters only. >> 2. Replace it with the [lowercase]\1\.\2[/lowercase] of the match. >> You could do the same thing in Applescript, I just don't recall if >> there's a lowercase function as part of the default OSAX or if you >> need a special OSAX to do it. If you're using UNIX, you could use a >> shell script which may be easier to program for recursion, but I >> don't know how you'd lowercase the matching pattern in the shell. >> There's a tr command, but I'm not sure how to get it to operate on >> just the matching characters. Frankly I'd like to see a WebDNA >> solution to this because it has all of the components necessary >> except for easy file recursion. >> Bill > > > > Hi Bill, > > I use BBEdit all the time to change text strings in all the files of a > selected folder, but I never use BBEdit's grep so do this, instead I > do it by entering the text into the "search for" and "replace with" > fields. This works fine for one or a few changes, and it *does* > replace uppercase with lowercase if that's the only change I want to > make ... but it would be crazy to do this for every different file > reference in the entire web site hierarchy. > > I would also like to 'really' change the file names to lowercase > instead of making webdna do this 'on-the-fly' via your regular > expressions solution above. I can see how your solution will work, > but it seems like it will make webdna do a lot of extra processing > that would not be necessary if only the cases of the letters were > really changed in my templates, instead of just wrapping them all in > lowercase contexts. > > I'm not using UNIX nor am I using webdna 5.x so I cannot 'turn off' > case sensitivity as you suggested above. > > If anyone else knows a way to fix my templates please let me know. In > the meantime I will work on a potential solution that I just conceived > of myself which *may* be able to do it entirely in webdna ... > > -- > > Sincerely, > Kenneth Grome > ------------------------------------------------------------- > Outsource your WebDNA programming for $18 an hour or less! > ------------------------------------------------------------- > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://webdna.smithmicro.com/ ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Ken's grep question about renaming files to lowercase ( Kenneth Grome 2003)
  2. Re: Ken's grep question about renaming files to lowercase ( William DeVaul 2003)
  3. Re: Ken's grep question about renaming files to lowercase ( Alex McCombie 2003)
  4. Re: Ken's grep question about renaming files to lowercase ( Kenneth Grome 2003)
  5. Re: Ken's grep question about renaming files to lowercase ( devaulw@onebox.com 2003)
Ken, Can't you have webdna do this not on the fly but by replacing files recursively using writefiles? i agree that on the fly is problematic. Bill Kenneth Grome wrote: > To: (WebDNA Talk) > Date: Wed, 3 Sep 2003 01:18:14 +0800 > From: Kenneth Grome > Subject: Re: Ken's grep question about renaming files to lowercase > >> Ken, >> >> Speaking of unanswered questions, I think I have a partial solution >> to grepping your file names, however, I think you'd have to use an >> Applescript to do this in BBEdit because grep alone can't perform a >> change case function easily to a matched string. If anyone else >> knows otherwise, please let me know. This is the logic (working >> syntax will vary) for how I'd approach it in WebDNA: >> >> 1. Match a filename using a regular expression such as >> ([0-9A-Za-z]+)\.(tpl|htm|html|dna|gif|jpg|png) You could turn off >> case sensitivity in WebDNA 5.0 so you wouldn't need to consider >> permutations of lower/uppercase characters. This assumes all file >> names are alphabetical or numerical characters only. >> 2. Replace it with the [lowercase]\1\.\2[/lowercase] of the match. >> You could do the same thing in Applescript, I just don't recall if >> there's a lowercase function as part of the default OSAX or if you >> need a special OSAX to do it. If you're using UNIX, you could use a >> shell script which may be easier to program for recursion, but I >> don't know how you'd lowercase the matching pattern in the shell. >> There's a tr command, but I'm not sure how to get it to operate on >> just the matching characters. Frankly I'd like to see a WebDNA >> solution to this because it has all of the components necessary >> except for easy file recursion. >> Bill > > > > Hi Bill, > > I use BBEdit all the time to change text strings in all the files of a > selected folder, but I never use BBEdit's grep so do this, instead I > do it by entering the text into the "search for" and "replace with" > fields. This works fine for one or a few changes, and it *does* > replace uppercase with lowercase if that's the only change I want to > make ... but it would be crazy to do this for every different file > reference in the entire web site hierarchy. > > I would also like to 'really' change the file names to lowercase > instead of making webdna do this 'on-the-fly' via your regular > expressions solution above. I can see how your solution will work, > but it seems like it will make webdna do a lot of extra processing > that would not be necessary if only the cases of the letters were > really changed in my templates, instead of just wrapping them all in > lowercase contexts. > > I'm not using UNIX nor am I using webdna 5.x so I cannot 'turn off' > case sensitivity as you suggested above. > > If anyone else knows a way to fix my templates please let me know. In > the meantime I will work on a potential solution that I just conceived > of myself which *may* be able to do it entirely in webdna ... > > -- > > Sincerely, > Kenneth Grome > ------------------------------------------------------------- > Outsource your WebDNA programming for $18 an hour or less! > ------------------------------------------------------------- > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://webdna.smithmicro.com/ ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ William DeVaul

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Problem during evaluation of WebCatalog (1998) Multiple catalog databases and showcart (1997) Bug or syntax error on my part? (1997) Showif vs. IF/then/else (2001) Resume Catalog ? (1997) (1997) select multiple 2 more cents (1997) date display (1999) NetCloak as Emailer substitute? (1999) [input] formating (1998) Help name our technology! I found it (1997) WCS Newbie question (1997) emailer truncates last letter! (1997) createfolder default behavior (1998) [LOOKUP] (1997) Web Logs (1998) HELP WITH DATES (1997) Post size Limit? (1998) Country & Ship-to address & other fields ? (1997) E-mailer error codes (1997)