473,383 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Folder browsing

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

System.IO.DirectoryInfo didocs1=new
System.IO.DirectoryInfo("C:\\Shearings\\" + 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 1505
didocs1.GetFiles ();
didocs1.GetDirectories ();

Not sure about security issues.

Eliyahu

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

System.IO.DirectoryInfo didocs1=new
System.IO.DirectoryInfo("C:\\Shearings\\" + 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.DirectoryInfo dicases1=new
System.IO.DirectoryInfo("C:\\Shearings\\" + jon + "\\" + folder);

DataGrid3.DataSource = dicases1.GetFiles();

DataGrid3.DataBind();

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
didocs1.GetFiles ();
didocs1.GetDirectories ();

Not sure about security issues.

Eliyahu

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

System.IO.DirectoryInfo didocs1=new
System.IO.DirectoryInfo("C:\\Shearings\\" + 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**************@TK2MSFTNGP11.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.DirectoryInfo dicases1=new
System.IO.DirectoryInfo("C:\\Shearings\\" + jon + "\\" + folder);

DataGrid3.DataSource = dicases1.GetFiles();

DataGrid3.DataBind();

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
didocs1.GetFiles ();
didocs1.GetDirectories ();

Not sure about security issues.

Eliyahu

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

System.IO.DirectoryInfo didocs1=new
System.IO.DirectoryInfo("C:\\Shearings\\" + 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
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...
1
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...
3
by: Rajiv Das | last post by:
VS 2003, XP SP2 ------------------------------------------------------------ DirectoryInfo temporary = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));...
2
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...
4
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
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...
1
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
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...
2
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...
0
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.