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

Editing multiple files

Expand Messages
  • John Shotsky
    Here is one I don t even know how to start: I have a web page with over 250 folders, and in each folder there is exactly one html file and a bunch of jpegs.
    Message 1 of 4 , Mar 3, 2014
    • 0 Attachment

      Here is one I don't even know how to start:

      I have a web page with over 250 folders, and in each folder there is exactly one html file and a bunch of jpegs. Think of it as a photo album.

      CSS is used to style these html pages. During a switch from an older, less capable web server to a current version of Apache, I have a need to add one line into each of those html file to identify the new location for the css file. The css file is not stored with each file, it is in a folder, and each html file references it. I have tested the new location, and it is fine, but the problem is how to get NoteTab to insert that line above the </head> line in each file, and save it.

      My folder structure is simple.

      Top folder

      6 sub folders

      6-12 subfolders in each of the above subfolders.

      1 html file in each of these folders.

      No other html files are present in any of these folders, so it is a matter of drilling down into each of the 6 subfolders, identifying the subfolders present there, add the line to each html file in each folder, then moving to the next subfolder.

      I could do a task 6 times by logging into each subfolder first, but I would like to see if it can be made to work on the whole site so that I can reuse that capability if I ever need to change all the xx files in a number of subfolders in the future.

      Can this be done no knowing the names of any of the files or the names of the folders they are in? Seems like it would have to store the 6 primary folder names, and loop through those one at a time. Then loop through the files below. I can't give you an example web page right now, because my old server is offline and can't be restarted ever again.

       

      Regards,
      John

    • Axel Berger
      ... I may be dense, but that sounds extremely simple to me. You have Find in files , with me that s but that may have been changed from
      Message 2 of 4 , Mar 3, 2014
      • 0 Attachment
        John Shotsky wrote:
        > in each folder there is exactly one html file
        > insert that line above the </head> line

        I may be dense, but that sounds extremely simple to me. You have "Find in
        files", with me that's <Shift><Control><F> but that may have been changed
        from the default, it is
        Search -> Search Disk -> Replace, tick subdirectories, mask *.htm,
        Search for
        ^P</HEAD>^P
        replace with
        ^P[new line]^P</HEAD>^P

        All done. Make a backup first, although this simple case is quite
        foolproof, I've done worse.

        Axel
      • loro
        ... Search Disk (on the Search menu). It does sub directories. Search for and replace with
        Message 3 of 4 , Mar 3, 2014
        • 0 Attachment
          At 21:10 2014-03-03, John Shotsky wrote:
          >Here is one I don't even know how to start:
          >I have a web page with over 250 folders, and in each folder there is
          >exactly one html file and a bunch of jpegs. Think of it as a photo album.
          >CSS is used to style these html pages. During a switch from an
          >older, less capable web server to a current version of Apache, I
          >have a need to add one line into each of those html file to identify
          >the new location for the css file. The css file is not stored with
          >each file, it is in a folder, and each html file references it. I
          >have tested the new location, and it is fine, but the problem is how
          >to get NoteTab to insert that line above the </head> line in each
          >file, and save it.
          >My folder structure is simple.
          >Top folder
          >6 sub folders
          >6-12 subfolders in each of the above subfolders.
          >1 html file in each of these folders.
          >No other html files are present in any of these folders, so it is a
          >matter of drilling down into each of the 6 subfolders, identifying
          >the subfolders present there, add the line to each html file in each
          >folder, then moving to the next subfolder.

          Search Disk (on the Search menu). It does sub directories. Search for
          "</head>" and replace with "<link rel="stylesheet" type="text/css"
          href="...">^P</head>".

          I did something similar on thousands of files once (an archived
          forum). Worked swell. But tick the security options anyway (Conform
          and Backup).

          Oh, if the files aren't saved with Windows line endings you may want
          to use the proper token for those file endings rather than ^P. Or
          just leave it out.

          Lotta
        • John Shotsky
          Thank you both. I didn t realize it would work that way. Regards, John RecipeTools Web Site: http://recipetools.gotdns.com/
          Message 4 of 4 , Mar 3, 2014
          • 0 Attachment

            Thank you both. I didn't realize it would work that way.

             

            Regards,
            John
            RecipeTools Web Site: http://recipetools.gotdns.com/
            John's Mags Yahoo Group:  http://groups.yahoo.com/group/johnsmags/

             

            From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of loro
            Sent: Monday, March 03, 2014 14:51
            To: ntb-clips@yahoogroups.com
            Subject: Re: [Clip] Editing multiple files

             

             

            At 21:10 2014-03-03, John Shotsky wrote:

            >Here is one I don't even know how to start:
            >I have a web page with over 250 folders, and in each folder there is
            >exactly one html file and a bunch of jpegs. Think of it as a photo album.
            >CSS is used to style these html pages. During a switch from an
            >older, less capable web server to a current version of Apache, I
            >have a need to add one line into each of those html file to identify
            >the new location for the css file. The css file is not stored with
            >each file, it is in a folder, and each html file references it. I
            >have tested the new location, and it is fine, but the problem is how
            >to get NoteTab to insert that line above the </head> line in each
            >file, and save it.
            >My folder structure is simple.
            >Top folder
            >6 sub folders
            >6-12 subfolders in each of the above subfolders.
            >1 html file in each of these folders.
            >No other html files are present in any of these folders, so it is a
            >matter of drilling down into each of the 6 subfolders, identifying
            >the subfolders present there, add the line to each html file in each
            >folder, then moving to the next subfolder.

            Search Disk (on the Search menu). It does sub directories. Search for
            "</head>" and replace with "<link rel="stylesheet" type="text/css"
            href="...">^P</head>".

            I did something similar on thousands of files once (an archived
            forum). Worked swell. But tick the security options anyway (Conform
            and Backup).

            Oh, if the files aren't saved with Windows line endings you may want
            to use the proper token for those file endings rather than ^P. Or
            just leave it out.

            Lotta

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