Solved

How to count files using asp.net

Posted on 2006-07-23
4
1,510 Views
Last Modified: 2010-05-18
Hello,

Using ASP.NET I want to count the number of files in a folder.

I've got this so far....(I'm moving email file from one folder to another....I would like to count the remaining files)
<%@ Import Namespace="System.IO" %>
<%@ Import namespace="System.Collections" %>
For Each s in Directory.GetFiles(sourcePath, "*.eml")
          File.Move(sourcePathFileName, destinationPathFileName)
Next

Thanks,

---- Mike

0
Comment
Question by:MikeCombe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
orbulat earned 500 total points
ID: 17165319
how about "Directory.GetFiles().Length "?
0
 
LVL 7

Expert Comment

by:irps20001
ID: 17165378
orbulat is absolutely correct, just a small insertion..

        Label1.Text = Directory.GetFiles(sourcePath, "*.eml").Length

Assumed a label exist and assigning the return value to label.text

Credit goes to orbulat.

0
 

Author Comment

by:MikeCombe
ID: 17165421
Thanks to BOTH of you.....very helpful !

--- Mike
0
 
LVL 10

Expert Comment

by:orbulat
ID: 17165560
thanks :-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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