473,952 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Folder browsing

I am using this code to get a list of folders and files

System.IO.Direc toryInfo didocs1=new
System.IO.Direc toryInfo("C:\\S hearings\\" + jonn + "\\" + folder);

I was wondering if there was a way to determine if the the folder had any
files or subfolders within it or whether it is empty

Thanks

Jon
Nov 18 '05 #1
3 1545
didocs1.GetFile s ();
didocs1.GetDire ctories ();

Not sure about security issues.

Eliyahu

"Jonathan Dixon" <jo**@ukonline. co.uk> wrote in message
news:uR******** ******@TK2MSFTN GP10.phx.gbl...
I am using this code to get a list of folders and files

System.IO.Direc toryInfo didocs1=new
System.IO.Direc toryInfo("C:\\S hearings\\" + jonn + "\\" + folder);

I was wondering if there was a way to determine if the the folder had any
files or subfolders within it or whether it is empty

Thanks

Jon

Nov 18 '05 #2


Sorry i did not explain properly

I am using the following code to bind a list of files to a datagrid but if
there are no folder of files the datagrid dissapears, i want a way to
check for files or folder before i bind the gird.

e.g

check for folder

if not folders, do nothing, if folders exist bind datagrid
System.IO.Direc toryInfo dicases1=new
System.IO.Direc toryInfo("C:\\S hearings\\" + jon + "\\" + folder);

DataGrid3.DataS ource = dicases1.GetFil es();

DataGrid3.DataB ind();

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
didocs1.GetFile s ();
didocs1.GetDire ctories ();

Not sure about security issues.

Eliyahu

"Jonathan Dixon" <jo**@ukonline. co.uk> wrote in message
news:uR******** ******@TK2MSFTN GP10.phx.gbl...
I am using this code to get a list of folders and files

System.IO.Direc toryInfo didocs1=new
System.IO.Direc toryInfo("C:\\S hearings\\" + jonn + "\\" + folder);

I was wondering if there was a way to determine if the the folder had any files or subfolders within it or whether it is empty

Thanks

Jon


Nov 18 '05 #3
Why not to read the list a files into an array and check the array size
before binding to it?

Eliyahu

"Jonathan Dixon" <jo**@ukonline. co.uk> wrote in message
news:uH******** ******@TK2MSFTN GP11.phx.gbl...


Sorry i did not explain properly

I am using the following code to bind a list of files to a datagrid but if
there are no folder of files the datagrid dissapears, i want a way to
check for files or folder before i bind the gird.

e.g

check for folder

if not folders, do nothing, if folders exist bind datagrid
System.IO.Direc toryInfo dicases1=new
System.IO.Direc toryInfo("C:\\S hearings\\" + jon + "\\" + folder);

DataGrid3.DataS ource = dicases1.GetFil es();

DataGrid3.DataB ind();

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
didocs1.GetFile s ();
didocs1.GetDire ctories ();

Not sure about security issues.

Eliyahu

"Jonathan Dixon" <jo**@ukonline. co.uk> wrote in message
news:uR******** ******@TK2MSFTN GP10.phx.gbl...
I am using this code to get a list of folders and files

System.IO.Direc toryInfo didocs1=new
System.IO.Direc toryInfo("C:\\S hearings\\" + jonn + "\\" + folder);

I was wondering if there was a way to determine if the the folder had any files or subfolders within it or whether it is empty

Thanks

Jon



Nov 18 '05 #4

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

Similar topics

3
2924
by: mallyonline | last post by:
Thank you for your previous help. I posted regarding listing the names of files held in a folder on the server and making the list appear clickable. This has now been accomplished. The files are listed - The files are clickable -
1
1812
by: S. van Beek | last post by:
Dear reader, For browsing to a file in a folder I am familiar with two windows, one with the following options on the left side of the window: · My Recent Documents · Desktop · My Documents · Computer.... · My Network Places
3
3916
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); }
2
2165
by: Ian B | last post by:
This is a basic question for anyone who knows what they're doing with web server admin so hopefully someone will be able to assist me here!... I have a www based asp.net application which allows users to upload images (screen captures for fault reporting). These files get saved in the folder www.<domain>.co.uk/uploadedfiles/<filename>. I want to prevent public users from being able to see these uploaded files but I want to provide an...
4
3149
by: santel_helvis | last post by:
Hi there, I wanna open the folder using asp.net. I am using anchor link to do that. But in href part how shall I give the location. Anyone plz help me out. Thanks in advance
0
1136
by: Sanja Tanasijevic | last post by:
I have serious problem setting read/write privilegues to the folder for customers upload files and photos including possibilities to read them too. Version of IIS is 5.1 and I set up this folder in IIS to have read, write, directory browsing and execute scripts. Also I set up anonimous access, I even tried with All Tasks -> Permissio Wizard but it doesn't help. Error "Access to path @c/Inetub/wwwroot/projectname/customerfolder/CustomerID is...
1
352
by: Nikolay Petrov | last post by:
I would like to replace the default page, which IIS shows, when a "folder browsing" i permited for some folder. I would like to use my own aspx page. Any ideas?
9
3722
by: Nick 'The Database Guy' | last post by:
Hi All, I want to browse to a particular folder, not a particular file. The reason for this is that I have a utility that asks people to browse to a certain file, and I want them to be able to choose the location that they start browsing. Thanks in advance.
2
1604
by: Jl_G_0 | last post by:
Hey all. Got a weird problem here. I need to open a folder that is on a server. The asp.net page and the IIS are on the same server. But i Cant access it from nowhere but locally. Simply because the link directs to eg. E:\Files\Stuff ... and when any computer tries to access it, it searches on itself and not on the server. Tried to create the folder (virtual folder) inside the ASP folder on IIS (enabled Allow File Browsing too) , but...
0
1118
by: Sagaert Johan | last post by:
Hi Is there a way to use the FolderBrowserDialog for browsing to a directory of the Mobile Device special folder I want to store a file directly on my device. Thanks Johan
0
11614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10709
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9920
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8289
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6242
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6367
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3568
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.