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

Re: [Clip] clip to save all index.html as index.htm

Expand Messages
  • abairheart
    ... index.htm? ... Yes, DOS is the more efficient way to go, but you do not need to loop to get the job done, if you use XCOPY. Let DOS/Windows do the hard
    Message 1 of 12 , Nov 5, 2006
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, Veli-Pekka Tätilä <vtatila@...> wrote:
      >
      > Mike Breiding wrote:
      > > <snip> check all directories for index.html and make a copy to
      index.htm?

      > The native Windows/DOS way is potentially much more interesting as it
      > doesn't need Perl. You gotta run this on the command-line and put the
      > command in a single line:
      >
      > for /f "usebackq delims=" %a in (`dir /s /b index.html`) do copy "%a"
      > "%~dpna.htm"
      >


      Yes, DOS is the more efficient way to go, but you do not need to loop
      to get the job done, if you use XCOPY. Let DOS/Windows do the hard
      stuff. See the sample clip below.

      Here is an excerpt from XCOPY help:

      XCOPY source [destination] /S /C /Q [/L] [/H] /Y

      source Specifies the file(s) to copy.
      destination Specifies the location and/or name of new files.
      /S Copies directories and subdirectories except empty ones.
      /C Continues copying even if errors occur.
      /Q Does not display file names while copying.
      /F Displays full source and destination file names while
      copying.
      /L Displays files that would be copied.
      /H Copies hidden and system files also.
      /Y Suppresses prompting to confirm you want to overwrite


      The ONE thing you must do is set the path in your clip before you
      execute the XCOPY command, otherwise, the destination files will not
      go to the correct folder.

      Use something like

      H="html to html plus htm"
      ^!Set %path%=site's root path (wizard or hard-code)
      ^!ChDr ^%path%
      ^!Dos "^%path%index.html" *.htm /S /C /Q /H /Y

      That's it. It will do the entire tree of files, if you want to TEST
      the result first, replace the /Q switch with the /L switch. Files will
      not actually get copied, but displayed in the commandline window.

      One more trick:

      append the DOS command with a "&pause" to keep the commandline window
      OPEN, when testing, so you can inspect the result at leisure.

      ^!Dos "^%path%index.html" *.htm /S /C /L /H /Y&pause


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