1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Inserting Code Into Multiple Files

Discussion in 'BlackHat Lounge' started by TheWicker, Dec 1, 2011.

  1. TheWicker

    TheWicker Power Member

    Joined:
    May 15, 2008
    Messages:
    576
    Likes Received:
    157
    Hey guys need a bit of an advice. I have around 3000 html files and I would need to place a bit of code into each of these files code in the exact same spot. Meaning I would like to place this part of code BEFORE or AFTER a particular peace of code on each of those html pages. How do I do this easiest. Is there such a function in notepad++, dreamweaver or similar?
     
  2. itzcorky

    itzcorky Junior Member

    Joined:
    Nov 1, 2011
    Messages:
    140
    Likes Received:
    67
    Occupation:
    Being a Boss
    Use dreamweaver and use the search function and it will have replace with option when you press CTRL + F. If you need anymore help just shoot me a pm.
     
  3. TheWicker

    TheWicker Power Member

    Joined:
    May 15, 2008
    Messages:
    576
    Likes Received:
    157
    Thanks for your answer. I am aware of this function, but it's pretty limited. This will replace me the code in ONE file. But I have 3000 of them and I am looking to save time and not open each file separately and put the code in it.

    What I'm looking for is a batch replace function for multiple (thousands) files.

    EDIT: Looks like I've found a cool little app that does that. Here it is if someone's having the same problem:

    http://www.digitalvolcano.co.uk/content/textcrawler
     
    Last edited: Dec 1, 2011
  4. rpkrocks

    rpkrocks Jr. VIP Jr. VIP

    Joined:
    Feb 4, 2010
    Messages:
    921
    Likes Received:
    918
    Location:
    Bḥārata
    Home Page:
    Code:
    Thanks for your answer. I am aware of this function, but it's pretty  limited. This will replace me the code in ONE file. But I have 3000 of  them and I am looking to save time and not open each file separately and  put the code in it.
    Use WinAutomation To Do It Again And Again
     
  5. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    Notepad++ has a 'Search and replace' function that can work on directories. It also has just a plain 'search' on directories. The only caveat is it won't be formatted with new lines. To access it, do ctrl+f, go to the 'Find in files' tab and there you have your options. Be sure to click 'replace in files' and not 'find all'. Otherwise it will just search for what your replace and return the files and lines.
     
    • Thanks Thanks x 1
  6. TheWicker

    TheWicker Power Member

    Joined:
    May 15, 2008
    Messages:
    576
    Likes Received:
    157
    Cheers, can't believe I've missed this... I'm using notepad++ every day.
     
  7. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    Ignore the caveat, I just did some testing. If you select 'Extended' for the search mode (bottom left), you can put in new lines using \r\n . If you want tabs you can use \t . Using both is this: \r\n\t
     
    • Thanks Thanks x 1
  8. roamer

    roamer Power Member

    Joined:
    Dec 2, 2008
    Messages:
    500
    Likes Received:
    479
    Occupation:
    Gfx designer, vfx and mgfx
    Location:
    plɹoʍ ǝɥʇ punoɹɐ ƃuıɯɐoɹ
    +1 to notepad++, although I'm more used to UltraEdit's replace in files function, mainly because I've had a copy for ages (but it's bloatware now compared to notepad++).