get images from a directory vb.net

Tags:
VB.NET
How to get all the images from a directory and a sub directory in vb.net Can I have the code for it in vb.net?

Answer Wiki

Thanks. We'll let you know when a new response is added.

<pre> Imports System.IO

Dim strFileSize As String = “”
Dim di As New IO.DirectoryInfo(“C:\temp”)
Dim aryFi As IO.FileInfo() = di.GetFiles(“*.*”)
Dim fi As IO.FileInfo

For Each fi In aryFi
if fi.Extension = “.jpg” or fi.Extension = “.gif” or fi.Extension = “.bmp” ”etc etc etc
strFileSize = (Math.Round(fi.Length / 1024)).ToString()
Console.WriteLine(“File Name: {0}”, fi.Name)
Console.WriteLine(“File Full Name: {0}”, fi.FullName)
Console.WriteLine(“File Size (KB): {0}”, strFileSize )
Console.WriteLine(“File Extension: {0}”, fi.Extension)
Console.WriteLine(“Last Accessed: {0}”, fi.LastAccessTime)
Console.WriteLine(“Read Only: {0}”, (fi.Attributes.ReadOnly = True).ToString)
End if
Next</pre>

Adjust your code in order to match the given file extensions.
Bye

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following