Getting files from a folder.

Posted on 2011-10-18
Last Modified: 2012-05-12
Hi all,

I’ve got a folder where I want to grab just one file at a time.
The trouble is the folder has thousands of files in and when I use GetFile it grabs all the files for each time I want to get just 1.

What’s the best way of doing this ?

Thanks in advance,
Question by:Kinger247
    LVL 28

    Accepted Solution

    Unless you know the name of each file, you can't just pull one. However, the "GetFiles()" method will only get a string array of all the file names from which you can load a file object.

    If you can provide a bit more detail as to what you are trying to do, there may be a better way.
    LVL 20

    Assisted Solution

    How do you know what one file you want to get? What do you want to do with it?
    LVL 4

    Assisted Solution

    I'd remove the ARCHIVE attribute from all files (ATTRIB -A *.*).
    Then pick the first file from your GetFile list that has the archive bit off (Fileinfo), do something with it (you know what, I don't), and then put the archive bit on. This way you will in the end process all files, one by one.
    LVL 14

    Assisted Solution

    by:nishant joshi
    which type of file you want to get what was the extension and what about filename.....

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now