Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Iterate through files in a particular folder

Posted on 2006-04-20
3
Medium Priority
?
187 Views
Last Modified: 2010-04-23
I am building a website that stores images in a folder with the id of a particular user.  If a user stores more than one picture the folder will look like this

Images
 - 1001_web.jpg
 - 1001_web1.jpg
 - 1001_web2.jpg


Given I have a userid, how can I get a collection of images  that start with that userid?
0
Comment
Question by:rodmjay
  • 2
3 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16500165
Hi rodmjay;

Try this

        Dim di As New System.IO.DirectoryInfo("FolderPath")
        Dim fi() As System.IO.FileInfo
        fi = di.GetFiles(UserId & "1001_web?..jpg")

        For Each f As System.IO.FileInfo In fi
            Console.WriteLine(f.FullName)
        Next


Fernando
0
 
LVL 8

Author Comment

by:rodmjay
ID: 16501437
maybe you could help me a littlw with the search pattern a little bit.

The userid is the 1001 and there could be other images that are 1001_thumb, etc
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 16501708
Hi rodmjay;

This will return all jpg files for user ID 1001.

    fi = di.GetFiles("1001*.jpg")

This will return all files in the directory for user 1001.

    fi = di.GetFiles("1001*")


Fernando
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline

564 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