Results 1 to 10 of 10

Thread: Multiple Files

  1. #1

    Thread Starter
    Addicted Member adamlonsdale's Avatar
    Join Date
    Oct 2005
    Posts
    210

    Multiple Files

    Okay...

    When i deploy my application, i will need about 2000 text files to go with it.

    I have a list of names. In the format of:

    'Forename Surname'

    But i want to export that list into text files, so each file name will be like

    'Surname, Forename.txt'

    But i suppose i could go through the list and re-arrange the list.

    Thanks

    - Adam

    Edit: Also... Each file should contain:

    Code:
    Forename
    Surname
    N/A
    N/A
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    //Initial Points\\
    50
    Last edited by adamlonsdale; May 26th, 2007 at 04:09 AM.

  2. #2
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Multiple Files

    Create a file with just the info you posted then read thru the other file to create the file you want then append the info you read from the first file.

  3. #3
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Multiple Files

    well if you have Excel installed you could import the text file separated with spaces, then switch the columns around and resave as .csv format.
    rename the finished file appropriately. Note that there wouldn't be any spaces this way.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  4. #4

    Thread Starter
    Addicted Member adamlonsdale's Avatar
    Join Date
    Oct 2005
    Posts
    210

    Re: Multiple Files

    Hey there,

    Okay i have swapped them about, and now i have the following Format:

    Code:
    Tindall, Emily
    Tindall, Philip
    Tomlinson, Christopher
    Tomlinson, Sophie
    Towle, Paige
    Towner, Samuel
    Towns, Daniel
    Ture, Ana
    Turner, James
    Burgess, Scott
    Twidal, Sam
    Verity, Thomas
    Waddy, George
    Walker, Daniel
    Ward, Jenna
    Ward, Nicola
    Ward, Rhys
    Warsop, Amy
    Watson, Sophie
    Watts, Scott
    Webster, Patrick
    Whinham, Amy
    Whitehead, Henry
    White, Megan
    Wilcock, Michael
    Wilkinson, Bethany
    Williams, Adam
    How do i export each line as a .txt file? With the contents i wanted.

    e.g a Batch Copy, Paste and Rename

  5. #5
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Multiple Files

    Why not just have the installation process create the files. Create the file that has the data you want to deploy then copy it to the new names in code.

    Read the csv file
    rearrange the name to file name format
    Copy the original data to that filename


    FSO.CopyFile BaseFile, NewFilename

  6. #6

    Thread Starter
    Addicted Member adamlonsdale's Avatar
    Join Date
    Oct 2005
    Posts
    210

    Re: Multiple Files

    Quote Originally Posted by randem
    Why not just have the installation process create the files. Create the file that has the data you want to deploy then copy it to the new names in code.

    Read the csv file
    rearrange the name to file name format
    Copy the original data to that filename


    FSO.CopyFile BaseFile, NewFilename
    huh? I think i may have a slight idea, but if the CSV file is already rearranged, do i have to re-arrange it again?

  7. #7
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Multiple Files

    If the names are in the correct order then you need to do nothing but remove the comma cause you can't have commas in the filename.

  8. #8

    Thread Starter
    Addicted Member adamlonsdale's Avatar
    Join Date
    Oct 2005
    Posts
    210

    Re: Multiple Files

    Are you sure?

    Because i currently have 4 files which i tested the program with, and they all have commas?

    And i have no clue how to do this, i just attempted it, but its because i want the forename and surname in the file aswell as the file name.

  9. #9
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Multiple Files

    Then you will need to

    Generate the file name
    Open the file for output (create)
    Write out the users name
    Write out the remaining data contained in a byte array or string.

  10. #10
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Multiple Files

    it coult be something like this
    open "masterlist.csv" for input as #1
    do
    if eof(1) then exit do
    line input #1, Name$
    open name$ + ".txt" for output as #2
    'output data here
    print #2, datayouhavetostore
    close #2
    loop
    close #1
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width