1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

FileSystemObject -- Help Please

Discussion in 'Software Development' started by xanderxvr, Jan 31, 2005.

Thread Status:
Not open for further replies.
Advertisement
  1. xanderxvr

    xanderxvr Thread Starter

    Joined:
    Jan 31, 2005
    Messages:
    3
    i am not sure if i understand the assignment that says "

    ----------------------------------------------------------------------
    '1. Connect to the folder that was listed on the sheet (w:\boseo\)
    fso.GetFolder

    'There are probably going to be several folders and files so I will have to loop through
    ' these items to find just the text files

    2.
    'Start loop
    3. 'If this is a text file...
    4. 'Write the name of the file to the screen
    5. 'I may need use this file name later (hint) so goahead and put it in
    ' a variable so we can call it on the page...
    6. 'End loop

    -------------------------------------------------------------------
    i tried to program in this code but he said its not right. i don't understand to read this instruction above... pleaes help me.. thanks...

    -------------------------------------------------------------------
    <%@ Language=VBScript %>
    <% Option Explicit %>

    <HTML>
    <BODY>
    <%
    Sub AddNewFolder(w:\boseo, foldername)
    Dim fso, f, ts

    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    set f = fso.GetFolder("w:\boseo")


    If fso.getfolder("w:\boseo") = true then
    set f = fso.CreateTextFile("w:\boseo\hello.txt")
    Else
    set f= fss.openFile("w:\boseo\hello.txt")
    End If

    %>

    </BODY>
    </HTML
    ----------------------------------------------------
    I tried this code but he told me its not correct... i still don't understand his instruction.... pleaes help me out... thanks...
    -------------------------------------------------------------

    <%@ Language=VBScript %>
    <% Option Explicit %>

    <HTML>
    <BODY>
    <%
    Sub AddNewFolder(w:\boseo, foldername)
    Dim fso, f, fc, ts, nf

    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    set f = fso.GetFolder("w:\boseo")
    set fc = f.subfolders

    If fso.getfolder("w:\boseo") <> "" then
    set nf = fc.add(w:\boseo)
    Else
    set nf = fc.add("w:\boseo\hello.txt")
    End If
    End Sub
    %>

    </BODY>
    </HTML
    ----------------------------------------
    he said above is not right he said i didn't understand the concepts and follow his instructions....... please help me out... thanks lots...


    any idea or suggestion?... please post correct codes here so i can understand better.. thanks thanks thankst hanks lots lots......
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
  3. xanderxvr

    xanderxvr Thread Starter

    Joined:
    Jan 31, 2005
    Messages:
    3
    dim f2
    'dim ts
    Set f2 = fso.GetFile("w:\boseo\" & strFile)
    Set ts = f2.OpenAsTextStream(1,-2)

    do while ts.AtEndOfStream = False
    Response.Write ts.ReadLine & "<BR>"

    '(how can i collect the vaues from the file and put them in the right order? How can i create a variable to store all the data in and then i can just call that variable later?)

    loop
    --------------------------------
    how can i collect the vaues from the file and put them in the right order?

    How can i create a variable to store all the data in and then i can just call that variable later?
     
  4. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    There isn no way to sort them unless you loop through the folders and then the files. I saw one piece of code at one time that allowed for sorting but it was wayyyy to cumbersome. You already have the variable named ts for your text stream.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - FileSystemObject Help Please
  1. Amount
    Replies:
    2
    Views:
    159
  2. MarkLopez912
    Replies:
    3
    Views:
    236
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/325210

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice