Loading ...
Sorry, an error occurred while loading the content.
 

Re: [Clip] Changing _ in File Names to -

Expand Messages
  • Axel Berger
    ... I must admit, I hadn t quite grasped what was the task here. Renaming files on disk with such simple rules is a trivial task for TotalCommander. And
    Message 1 of 7 , Mar 23, 2008
      "Don - HtmlFixIt.com" wrote:
      > I hope that was clear so that you kept a copy of the before names.

      I must admit, I hadn't quite grasped what was the task here. Renaming
      files on disk with such simple rules is a trivial task for
      TotalCommander.
      And renaming links in the files does not seem to be difficult either.
      After all, with a regex it is quite simple to identify a space in a file
      name in a link and replace it. You loop that until no more are found and
      go to the next file. I have often done similar things and keep a
      framework for that kind of task:

      ---------------------------------------------------------------------
      ; Adapt this part to the task in hand
      ^!Set %varFIL%="F:\Webspace\index.php"
      ^!Set %varPAT%="*.htm;*.php"
      ; End of invidual adaptation

      ^!SetWizardLabel "Please define the files to be converted"
      ;^!SetDebug On
      ^!Set %varFIL%=^?{(T=O;F="Source
      Files|*.html;*.htm;*.?html;*.xml;*asp;*.css;*.php;*.php3;*.php4")Sample
      file=^%varFIL%}; %varSDR%=^?{(T=L)Include Subdirectories?==_Yes|No};
      %varPAT%=^?{Search Pattern=^%varPAT%}
      ^!Set %varPTH%=^$GetPath(^%varFIL%)$
      ^!If "^%varSDR%"="Yes" yessub ELSE nosub
      :yessub
      ^!Set %varFIL%=^$GetFileFirst("+^%varPTH%";"^%varPAT%")$
      ^!Goto loop
      :nosub
      ^!Set %varFIL%=^$GetFileFirst("^%varPTH%";"^%varPAT%")$
      :loop
      ^!IfTrue ^$IsEmpty(^%varFIL%)$ finished
      ;^!Continue ^%varFIL%
      ^!Open "^%varFIL%"

      ; Adapt this part to the task in hand

      ^!Replace "http://www.w3.org/Icons/valid-html401" >>
      "http://berger-odenthal.de/pics/valid-html401.png" WAS
      ^!Replace "http://jigsaw.w3.org/css-validator/images/vcss" >>
      "http://berger-odenthal.de/pics/vcss.png" WAS

      ;^!Replace "//EN"> <" >> "//EN"^P
      "http://www.w3.org/TR/html4/loose.dtd">^P<" WAS

      ; End of invidual adaptation

      ^!Close ALL,SAVE
      ^!Set %varFIL%=^$GetFileNext$
      ^!Goto loop
      :finished
      ^!CloseFileFind
      ---------------------------------------------------------------------
      ---> 34 lines including empty ones

      N.B: I just notice my question to the group about length limits in find
      and replace strings hast not yet been answered. You'll notice the last
      replace is shorter than it ought to be for complete unambiguity, but
      what is placed there is the maximum the menu replace would take while
      testing.

      Axel
    Your message has been successfully submitted and would be delivered to recipients shortly.