Program to create files based on a text list?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • uno
    RIP Dodger. BEST.CAT.EVER
    • Dec 2002
    • 18450

    #1

    Program to create files based on a text list?

    Does anyone know of a program to create files based on a text list?

    For ex. my text list would look like:

    1
    2
    3
    4
    5

    I'd want to create:
    1.txt
    2.txt
    3.txt
    4.txt
    5.txt

    etc...
    -uno
    icq: 111-914
    CrazyBabe.com - porn art
    MojoHost - For all your hosting needs, present and future. Tell them I sent ya!
  • SmokeyTheBear
    ►SouthOfHeaven
    • Jun 2004
    • 28609

    #2
    would be simple to do in php

    what would you like the file to contain.?
    hatisblack at yahoo.com

    Comment

    • uno
      RIP Dodger. BEST.CAT.EVER
      • Dec 2002
      • 18450

      #3
      Originally posted by SmokeyTheBear
      would be simple to do in php

      what would you like the file to contain.?
      some code that would also contain the name of the file-ext. in the file.
      -uno
      icq: 111-914
      CrazyBabe.com - porn art
      MojoHost - For all your hosting needs, present and future. Tell them I sent ya!

      Comment

      • SmokeyTheBear
        ►SouthOfHeaven
        • Jun 2004
        • 28609

        #4
        Originally posted by uno
        some code that would also contain the name of the file-ext. in the file.
        ok well heres how you do it in php

        make a folder somewhere

        put the code below in a file called index.php

        make a folder called results. this is where the created files willl be saved ( chmod the folder to be writeable )

        save the list in a file called file.txt ( in the same folder as index.php )

        Code:
        <?php
        
        $fil = "file.txt";
        $sc = file_get_contents($fil);
        $emt = explode("\n",$sc);
        
           foreach( $emt as $pn => $mub){
        
        $dub = str_replace(" ","-",$mub);
        $wrt = "STUFF INSIDE FILE $dub.txt";
        $fol = "results/$dub.txt";
        echo "Saved $dub.txt \n<br>";
        $hn = fopen($fol, 'w+');
        fwrite($hn, $wrt);
        fclose($hn);
        }
        ?>
        hatisblack at yahoo.com

        Comment

        • SmokeyTheBear
          ►SouthOfHeaven
          • Jun 2004
          • 28609

          #5
          if you have troubles let me know
          hatisblack at yahoo.com

          Comment

          • uno
            RIP Dodger. BEST.CAT.EVER
            • Dec 2002
            • 18450

            #6
            Wow, thanks man!
            -uno
            icq: 111-914
            CrazyBabe.com - porn art
            MojoHost - For all your hosting needs, present and future. Tell them I sent ya!

            Comment

            • uno
              RIP Dodger. BEST.CAT.EVER
              • Dec 2002
              • 18450

              #7
              I'm really going to need to learn php one of these days.
              -uno
              icq: 111-914
              CrazyBabe.com - porn art
              MojoHost - For all your hosting needs, present and future. Tell them I sent ya!

              Comment

              Working...