473,545 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get number of files in a folder

i have created a new folder inside project(say update for storing
update files for software)
how can i get total number of files in that folder.what will be full
path for accessing that folder.(path compatibile for use in system.io)

Jun 1 '06 #1
1 4625
To get the number of files in a folder, use the following:
Dim filecount as Integer =
System.IO.Direc tory.GetFiles(S erver.MapPath(" ./")).Length( )
This code gets the number of files in the current directory. Server.MapPath
takes one parameter which is a String that is the relative path to the
desired directory and returns the complete path on the server. To get the
number of files in a different directory, simply change the parameter to
something like:
Dim filecount as Integer =
System.IO.Direc tory.GetFiles(S erver.MapPath(" myfiles/")).Length( )
Because the parameter is a relative path, you can also use "../" to go up
one directory. If you have any questions, feel free to ask or see the
documentation. Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"sasikumar" <sa*********@gm ail.com> wrote in message
news:11******** *************@c 74g2000cwc.goog legroups.com...
i have created a new folder inside project(say update for storing
update files for software)
how can i get total number of files in that folder.what will be full
path for accessing that folder.(path compatibile for use in system.io)

Jun 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5260
by: Galbu | last post by:
Hi all. I know there's a thread 'bout windows programming, but I can't find it anymore. However.. Here's my problem: I need to copy some files in the program files directory in C:\ The problem is this folder changes its name in according with the system language, e.g. in italian version it's "Programmi", while in English it's "Program...
1
11384
by: RFS | last post by:
how do I get the path to the Program Files folder?
3
3900
by: Rajiv Das | last post by:
VS 2003, XP SP2 ------------------------------------------------------------ DirectoryInfo temporary = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)); FileInfo files = temporary.GetFiles(); foreach(FileInfo fi in files) { Console.WriteLine(fi.FullName); }
5
4438
by: Roy | last post by:
My dll file is copied to the "%windir%\Microsoft.NET\Framework\{version}Temporary ASP.NET Files" folder when I compile my asp.net project. When I run the application. The dll under this folder is loaded, not the one under bin folder. Why is that? How can I load the one under bin folder?
0
1146
by: studentintau | last post by:
I would thank you if you help me with the next subject : how do i copy all files from temporary internet files folder to another folder in drive D?
1
4258
by: =?Utf-8?B?UmFkZW5rb19aZWM=?= | last post by:
I am using standard File.Copy(source,dest,true) method in C# and I have problem with copying large number of files. Here is my code: foreach (FileInfo file in files) { File.Copy(file.FullName,destPath+ "\\" + file.Name, true); } This code copies only 5 or 10 files but in "files" collection there is 60 files.
6
2401
by: chrisbirk | last post by:
Hi! I want to write an application on windows xp, which iterates n times a model script (exe) and copies every single run the results (multiple files such as text, maps, subfolders,etc) from the existing folder into a new one. The code works, but no files nor folders are copied. This is how far as I got being an absolute beginner in Java. Thanks...
5
1719
by: Warren Tang | last post by:
Hi I am trying to debug the code generated for aspx files. The following assembly is generated for an aspx page: App_Web_webform1.aspx.19c0ab3f.kajnxlqq.dll!ASP.main_test_webform1_aspx.ProcessRequest(System.We... However when I click on the it in the Call Stack window, it says: There is no source code available for the current...
1
1957
by: btreddy | last post by:
Hii all , when i try to run my aspx page i'm getting the following error. The current identity (BLR0248\ASPNET) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'. I went to the folder Temporary ASP.NET Files', right clicked on Properties, then Security, then added the uses...
0
7490
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7449
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6009
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5351
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.