473,883 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.IO.Direc tory.GetDirecto ries() and System.IO.Direc tory.GetFiles() are not returning the specified directory

I have an ASP.NET application which displays the directories & files in a
specified directory on the server. I use the
System.IO.Direc tory.GetDirecto ries() and System.IO.Direc tory.GetFiles() to
retrieve the lists of files and directories. I have two very similar
versions of this that I am debugging, both of which use the methods
mentioned above. However, one of them is returning the contents of the
specified directory and the other is returning the contents of the project's
directory. I have checked to see what values are used by and returned by
System.IO.Direc tory.GetDirecto ries() and System.IO.Direc tory.GetFiles() , and
they use the values I expect, but do not return the directories and files in
that directory. What is going on here?

Sep 6 '07 #1
2 4948
"Nathan Sokalski" <nj********@hot mail.comwrote in message
news:eh******** ******@TK2MSFTN GP05.phx.gbl...
>I have an ASP.NET application which displays the directories & files in a
specified directory on the server. I use the
System.IO.Dire ctory.GetDirect ories() and System.IO.Direc tory.GetFiles() to
retrieve the lists of files and directories. I have two very similar
versions of this that I am debugging, both of which use the methods
mentioned above. However, one of them is returning the contents of the
specified directory and the other is returning the contents of the
project's directory. I have checked to see what values are used by and
returned by System.IO.Direc tory.GetDirecto ries() and
System.IO.Dire ctory.GetFiles( ), and they use the values I expect, but do
not return the directories and files in that directory. What is going on
here?
[X-posting removed]

Please show your code...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 6 '07 #2
On Sep 6, 11:23 am, "Nathan Sokalski" <njsokal...@hot mail.comwrote:
I have an ASP.NET application which displays the directories & files in a
specified directory on the server. I use the
System.IO.Direc tory.GetDirecto ries() and System.IO.Direc tory.GetFiles() to
retrieve the lists of files and directories. I have two very similar
versions of this that I am debugging, both of which use the methods
mentioned above. However, one of them is returning the contents of the
specified directory and the other is returning the contents of the project's
directory. I have checked to see what values are used by and returned by
System.IO.Direc tory.GetDirecto ries() and System.IO.Direc tory.GetFiles() , and
they use the values I expect, but do not return the directories and files in
that directory. What is going on here?
Both of those methods work fine for me. You will need to post some
actual code that is having the problem.

Sep 6 '07 #3

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

Similar topics

1
383
by: Earl Teigrob | last post by:
Does someone have or know of an algorythm (method) that will delete all files under a give directory and its subdirectories based on a wildcard mask? I can use this for one directory for each file in Directory.GetFiles("pic1.*") file.Delete() but will need to use a recursive algorythm to get all its subdirectories
4
3721
by: Elmo Watson | last post by:
Is there a way, with the System.IO class, to do a recursive list of a directory structure? For instance, in DirectoryInfo, you have GetDirectories and GetFiles .... In Directory, you have Directory.GetFileSystemEntries(path), but I would like to know how to put this together, knowing which entry is a Subdirectory and which entry is a file, and make a recursive list of the Directory structure below a specific path - - -
1
5188
by: Trint Smith | last post by:
I can get file names with the following code... Dim di As New DirectoryInfo("c:\OrderData\Database") Dim fiArr As FileInfo() = di.GetFiles() Dim f As FileInfo For Each f In fiArr Dim fileword As String = (f.Name) sfw1a.WriteLine(fileword) txtFileText.Text = (fileword)
0
2975
by: dim mzeura via .NET 247 | last post by:
(Type your message here) -------------------------------- From: dim mzeura I have the same problem too. Please help! System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression ''\\crwfs1\projects12\AP-Wilbur\Analysis_NonQuantitative\Damages_Report\Backup_Exhibits_Leitzinger's_Damages_Calculations', '328424' )'. -----Here is my code----
3
4164
by: cjb | last post by:
Is there a way to get Directory.GetFiles to return multi-language file names? I haven't found any overloads that allow any such parameter. The way I am using it now is: foreach (string d in Directory.GetDirectories("C:\\")) { foreach (string f in Directory.GetFiles(d, "*.exe")) { MessageBox.Show(f); } }
1
2817
by: Nathan Sokalski | last post by:
I have an ASP.NET application which displays the directories & files in a specified directory on the server. I use the System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() to retrieve the lists of files and directories. I have two very similar versions of this that I am debugging, both of which use the methods mentioned above. However, one of them is returning the contents of the specified directory and the other is...
3
4312
by: Nathan Sokalski | last post by:
I am getting the list of subdirectories from a specified directory using System.IO.Directory.GetDirectories(), and would like to get only subdirectories that are not hidden or system directories. I did not notice any way to do this using System.IO.Directory.GetDirectories(). Is there some other function that I can use, or is there some way to determine whether a directory is hidden or system? Thanks. -- Nathan Sokalski...
3
2553
by: Michael Jackson | last post by:
In my .NET 2.0 VS 2005 VB application, I'm using Directory.GetFiles(path) to get all the files in the directory. However, I'm getting an error regarding "Illegal character in Path", even though I can copy, etc the file using the Windows XP explorer. I can trap the error, but then this traps the entire GetFiles() function, not just the one bad file. Is there a way to just trap for the one bad file and continue on?
3
4588
by: =?Utf-8?B?RGF2aWRN?= | last post by:
Hi, does anyone know if I can scan a subdirectory using wildcards? I do not see a way to do this using: string folder = @"C:\INPUT\CUSTOMERS\ID???BC.*" DirectoryInfo di = new DirectoryInfo(folder); FileInfo fileNames = di.GetFiles("AllInput_*.xml"); Basically, I have lots of foldres under C:\INPUT\CUSTOMERS and I want to the
0
11151
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
10750
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10858
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10419
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
9577
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
7974
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
5804
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
5996
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4619
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

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.