WordPress.org

Ready to get started?Download WordPress

Forums

Make many post from one text file (7 posts)

  1. iunewind
    Member
    Posted 6 years ago #

    Hi, i have a large arhive of information in plain text files, collected long time ago.
    In files, articles separated by tag, and in one file it may be thousands. One file - one category.
    I need automaticaly make many post in one category from this one file. How it can be maked?
    Maybe i need parser or importer engine, when make one post by one article in one category for own file.
    But i can't find that engine. For WP i find just hard way - make a houge WRX file (write xml sturcture by hand) but for this need to write parser. I dont have programer skill on php, but it only way what i see, and probably i must be try to learn basics of php and write parser.

    But maybe sombody know more easy way? Maybe somebody see importer, or other blog/cms system have a similar import function?
    Or maybe one of RSS importer can solve my problem with minimum changes in .txt files?
    Thanks

    p.s. crosspost from wp-advanced section

  2. nolageek
    Member
    Posted 6 years ago #

    I'm not sure if you could, but if there's any sort of way you could do some fancy search/replace to get it in the correct format, try manipulating it so it's in an import format that WP recognizes. I do this from time to time, and with excell and some fancy exporting and search and replace in wordpad I can get some stuff to resemble the Movable Type format:

    AUTHOR: Admin
    TITLE: This is title of the first post
    DATE: 09/10/2007 11:47:06
    CATEGORY: blog
    -----
    BODY:
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
    --------
    AUTHOR: Admin
    TITLE: This is title of the second post
    DATE: 09/06/2007 21:42:06
    CATEGORY: blog
    -----
    BODY:
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
    --------
    AUTHOR: Admin
    TITLE: This is title of the third post
    DATE: 08/13/2007 15:17:06
    CATEGORY: blog
    -----
    BODY:
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
    --------

    and so on...

  3. iunewind
    Member
    Posted 6 years ago #

    nolageek
    not sure i understand... i make that kind of formating, but how it can be importing in wordpress? as RSS or what?

  4. Doodlebee
    Member
    Posted 6 years ago #

    As he said, import it as a Moveable Type file.

  5. nolageek
    Member
    Posted 6 years ago #

    Manage -> Import -> Movable Type / TypePad

    I just did this with a bunch of TGP entries for an adult site I run. I downloaded a txt file with about 140 entries that were in this format:

    %name%|%date%|%category%|%gallery-url%|%img-url%

    a (Safe For Work) example would be like this:

    this is the name of the gallery|2007-09-01|Mountains|http://domain.com/index.html|http://domain.com/image.jpg

    I just stared at it until I found unique bits that I could search for and replace with the formatting I needed.

    I used MetaPad editor (it does search/replace with carriage returns (use \n))

    First, I did a search for .jpg and replaced with .jpg\nAUTHOR: Admin\nTITLE:

    That added the necessary intro to every entry except for the first one - which I added by hand.

    Second, did a search for .jpg again, this time replaced it with .jpg" />< /a>

    Then, I searched for index.html| and replaced with "><img src="

    Next, I searched for |http:// and replaced with -----\nBODY:\n< a href=http://"

    I then searched for |200 and replaced with \nDATE: 200

    I replaced the last | with \nCATEGORY:

    Next I searched for ----- and replaced it with \n-----

    Finally, I searched for AUTHOR: and replaced it with --------\nAUTHOR:

    This turned it into:

    --------
    AUTHOR: Admin
    TITLE: this is the name of the gallery
    DATE: 2007-09-01
    CATEGORY: Mountains
    -----
    BODY:
    <a href="http://domain.com/"><img src="http://domain.com/image.jpg" /></a>

    Looking back it seems far more complicated than it was. The hardest part was finding an editor that let me use returns in search/replaced.. I could have sword I had done that in Notepad.

  6. Doodlebee
    Member
    Posted 6 years ago #

    The hardest part was finding an editor that let me use returns in search/replaced

    I believe you *can* do this in NotePad, you just have to ebter the correct characters to show tabs, spaces, returns. somethign like \s for spaces, \n for line breaks.

    You can use NotePad++ or PSPad as well (both are free downloads)

  7. iunewind
    Member
    Posted 6 years ago #

    Thanks you guys!! I try to looking in this way.

    About editors, how support "Enter" replace - i prefer UltraEdit. Great text/html/code/etc editor, support many function, scripts, serch/replace in files and etc.
    Other nice editor - AceHtml, very strong, but little slow loading ;) But AceHtml have a free version, how i know.

Topic Closed

This topic has been closed to new replies.

About this Topic