473,800 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

API FindFirstFile\F indNextFile vs GetFiles

Hi All,

I'm working on a program that requires searching multiple drives for multiple file types
and cataloging them based on certain geospatial attributes. All together, there are
hundreds of thousands of files on the drives. As part of the process, I'm currently using
the GetFiles method of the FileSystem object to retrieve collection of strings
representing a collection of a particular file type (for example, tif files). The problem
is that the GetFiles method doesn't seem to make any callbacks that would allow for me to
show some sort of meaningful progress, and the process can take a very long time. I know
I could fudge it with a marquee style progress bar and\or a busy mouse icon, but this
isn't ideal.

So, I was looking into using the API to do the grunt work. This would allow me to at
least display each filename in a label control as the search is being performed. I'm
trying to port Randy Birch's VB6 code available on his website at
http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It's working
somewhat, except for the FindNextFile function which I've declared like so:

/////
Private Declare Function FindNextFile Lib "kernel32" _
Alias "FindNextFi leA" _
(ByVal hFindFile As Int32, _
ByVal lpFindFileData As WIN32_FIND_DATA ) As IntPtr
/////

As currently implemented, the function is not moving the search to the next file. It is
always returning the first file in the directory and it returns all the properties of that
file correctly. And it returns this first file for as many times as there are files in
the directory. I'm thinking it's because the WIN32_FIND_DATA - which is a UDT in the VB6
code - is defined as an object in my code and Dim'd as

/////
Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA
/////

at the beginning of the SearchForFiles Sub. For reference, in my code WIN32_FIND_DATA
defined like so:

/////
<StructLayout(L ayoutKind.Seque ntial, _
CharSet:=CharSe t.Auto)_
Friend Class WIN32_FIND_DATA
Friend sfileAttributes As Int32 = 0
Friend creationTime_lo wDateTime As Int32 = 0
Friend creationTime_hi ghDateTime As Int32 = 0
Friend lastAccessTime_ lowDateTime As Int32 = 0
Friend lastAccessTime_ highDateTime As Int32 = 0
Friend lastWriteTime_l owDateTime As Int32 = 0
Friend lastWriteTime_h ighDateTime As Int32 = 0
Friend nFileSizeHigh As Int32 = 0
Friend nFileSizeLow As Int32 = 0
Friend dwReserved0 As Int32 = 0
Friend dwReserved1 As Int32 = 0
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=MAX_ PATH)_
Friend fileName As String = Nothing
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=14)_
Friend alternateFileNa me As String = Nothing
End Class
/////

How can I make it so the FindNextFile call actually moves on to the next file in the
directory?

Lance
Aug 31 '06 #1
13 8573
what the heck? I didn't define WIN32_FIND_DATA as an object. It's a structure. There
goes my theory. Ugh, not enough coffee this morning. I'd still be interested in your
thoughts as to why the FindNextFile API function isn't working correctly.

Lance

"Lance" <nu***@business .comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi All,

I'm working on a program that requires searching multiple drives for multiple file types
and cataloging them based on certain geospatial attributes. All together, there are
hundreds of thousands of files on the drives. As part of the process, I'm currently
using the GetFiles method of the FileSystem object to retrieve collection of strings
representing a collection of a particular file type (for example, tif files). The
problem is that the GetFiles method doesn't seem to make any callbacks that would allow
for me to show some sort of meaningful progress, and the process can take a very long
time. I know I could fudge it with a marquee style progress bar and\or a busy mouse
icon, but this isn't ideal.

So, I was looking into using the API to do the grunt work. This would allow me to at
least display each filename in a label control as the search is being performed. I'm
trying to port Randy Birch's VB6 code available on his website at
http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It's working
somewhat, except for the FindNextFile function which I've declared like so:

/////
Private Declare Function FindNextFile Lib "kernel32" _
Alias "FindNextFi leA" _
(ByVal hFindFile As Int32, _
ByVal lpFindFileData As WIN32_FIND_DATA ) As IntPtr
/////

As currently implemented, the function is not moving the search to the next file. It is
always returning the first file in the directory and it returns all the properties of
that file correctly. And it returns this first file for as many times as there are
files in the directory. I'm thinking it's because the WIN32_FIND_DATA - which is a UDT
in the VB6 code - is defined as an object in my code and Dim'd as

/////
Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA
/////

at the beginning of the SearchForFiles Sub. For reference, in my code WIN32_FIND_DATA
defined like so:

/////
<StructLayout(L ayoutKind.Seque ntial, _
CharSet:=CharSe t.Auto)_
Friend Class WIN32_FIND_DATA
Friend sfileAttributes As Int32 = 0
Friend creationTime_lo wDateTime As Int32 = 0
Friend creationTime_hi ghDateTime As Int32 = 0
Friend lastAccessTime_ lowDateTime As Int32 = 0
Friend lastAccessTime_ highDateTime As Int32 = 0
Friend lastWriteTime_l owDateTime As Int32 = 0
Friend lastWriteTime_h ighDateTime As Int32 = 0
Friend nFileSizeHigh As Int32 = 0
Friend nFileSizeLow As Int32 = 0
Friend dwReserved0 As Int32 = 0
Friend dwReserved1 As Int32 = 0
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=MAX_ PATH)_
Friend fileName As String = Nothing
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=14)_
Friend alternateFileNa me As String = Nothing
End Class
/////

How can I make it so the FindNextFile call actually moves on to the next file in the
directory?

Lance


Aug 31 '06 #2
You could call the GetFiles method via a BackgroundWorke r. In your get
files method you could call the BackgroundWorke r ReportProgress method each
time a file is found/processed and in a handler for the BackgoundWorker
ProgressChanged event this will raise you could update the label control
with the filename.

For a free Visual Studio 2005 solution that provides source code for using
the BackgroundWorke r class visit ->
http://www.getdotnetcode.com/GdncSto...orkerClass.htm

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"Lance" <nu***@business .comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi All,

I'm working on a program that requires searching multiple drives for
multiple file types and cataloging them based on certain geospatial
attributes. All together, there are hundreds of thousands of files on the
drives. As part of the process, I'm currently using the GetFiles method
of the FileSystem object to retrieve collection of strings representing a
collection of a particular file type (for example, tif files). The
problem is that the GetFiles method doesn't seem to make any callbacks
that would allow for me to show some sort of meaningful progress, and the
process can take a very long time. I know I could fudge it with a marquee
style progress bar and\or a busy mouse icon, but this isn't ideal.

So, I was looking into using the API to do the grunt work. This would
allow me to at least display each filename in a label control as the
search is being performed. I'm trying to port Randy Birch's VB6 code
available on his website at
http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm .
It's working somewhat, except for the FindNextFile function which I've
declared like so:

/////
Private Declare Function FindNextFile Lib "kernel32" _
Alias "FindNextFi leA" _
(ByVal hFindFile As Int32, _
ByVal lpFindFileData As WIN32_FIND_DATA ) As IntPtr
/////

As currently implemented, the function is not moving the search to the
next file. It is always returning the first file in the directory and it
returns all the properties of that file correctly. And it returns this
first file for as many times as there are files in the directory. I'm
thinking it's because the WIN32_FIND_DATA - which is a UDT in the VB6
code - is defined as an object in my code and Dim'd as

/////
Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA
/////

at the beginning of the SearchForFiles Sub. For reference, in my code
WIN32_FIND_DATA defined like so:

/////
<StructLayout(L ayoutKind.Seque ntial, _
CharSet:=CharSe t.Auto)_
Friend Class WIN32_FIND_DATA
Friend sfileAttributes As Int32 = 0
Friend creationTime_lo wDateTime As Int32 = 0
Friend creationTime_hi ghDateTime As Int32 = 0
Friend lastAccessTime_ lowDateTime As Int32 = 0
Friend lastAccessTime_ highDateTime As Int32 = 0
Friend lastWriteTime_l owDateTime As Int32 = 0
Friend lastWriteTime_h ighDateTime As Int32 = 0
Friend nFileSizeHigh As Int32 = 0
Friend nFileSizeLow As Int32 = 0
Friend dwReserved0 As Int32 = 0
Friend dwReserved1 As Int32 = 0
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=MAX_ PATH)_
Friend fileName As String = Nothing
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=14)_
Friend alternateFileNa me As String = Nothing
End Class
/////

How can I make it so the FindNextFile call actually moves on to the next
file in the directory?

Lance


Aug 31 '06 #3
I thought about that but assumed the GetFiles method would still not report any progress
back to the BackgroundWorke r. Admittedly, I'm a little hazy on how the BackgroundWorke r
receives messages anyway. It was my understanding that if the GetFiles method didn't make
callbacks, then well, it didn't make callbacks.

Another thing that is attractive about the API method, though, is that I can search for
multiple file types at once. GetFiles seems to be limited to one type at a time. I would
be searching for and cataloging about a dozen different file types

Lance

"Mike McIntyre" <mi****@getdotn etcode.comwrote in message
news:eE******** *****@TK2MSFTNG P05.phx.gbl...
You could call the GetFiles method via a BackgroundWorke r. In your get files method you
could call the BackgroundWorke r ReportProgress method each time a file is
found/processed and in a handler for the BackgoundWorker ProgressChanged event this will
raise you could update the label control with the filename.

For a free Visual Studio 2005 solution that provides source code for using the
BackgroundWorke r class visit ->
http://www.getdotnetcode.com/GdncSto...orkerClass.htm

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"Lance" <nu***@business .comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>Hi All,

I'm working on a program that requires searching multiple drives for multiple file
types and cataloging them based on certain geospatial attributes. All together, there
are hundreds of thousands of files on the drives. As part of the process, I'm
currently using the GetFiles method of the FileSystem object to retrieve collection of
strings representing a collection of a particular file type (for example, tif files).
The problem is that the GetFiles method doesn't seem to make any callbacks that would
allow for me to show some sort of meaningful progress, and the process can take a very
long time. I know I could fudge it with a marquee style progress bar and\or a busy
mouse icon, but this isn't ideal.

So, I was looking into using the API to do the grunt work. This would allow me to at
least display each filename in a label control as the search is being performed. I'm
trying to port Randy Birch's VB6 code available on his website at
http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It's working
somewhat, except for the FindNextFile function which I've declared like so:

/////
Private Declare Function FindNextFile Lib "kernel32" _
Alias "FindNextFi leA" _
(ByVal hFindFile As Int32, _
ByVal lpFindFileData As WIN32_FIND_DATA ) As IntPtr
/////

As currently implemented, the function is not moving the search to the next file. It
is always returning the first file in the directory and it returns all the properties
of that file correctly. And it returns this first file for as many times as there are
files in the directory. I'm thinking it's because the WIN32_FIND_DATA - which is a
UDT in the VB6 code - is defined as an object in my code and Dim'd as

/////
Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA
/////

at the beginning of the SearchForFiles Sub. For reference, in my code WIN32_FIND_DATA
defined like so:

/////
<StructLayout( LayoutKind.Sequ ential, _
CharSet:=CharS et.Auto)_
Friend Class WIN32_FIND_DATA
Friend sfileAttributes As Int32 = 0
Friend creationTime_lo wDateTime As Int32 = 0
Friend creationTime_hi ghDateTime As Int32 = 0
Friend lastAccessTime_ lowDateTime As Int32 = 0
Friend lastAccessTime_ highDateTime As Int32 = 0
Friend lastWriteTime_l owDateTime As Int32 = 0
Friend lastWriteTime_h ighDateTime As Int32 = 0
Friend nFileSizeHigh As Int32 = 0
Friend nFileSizeLow As Int32 = 0
Friend dwReserved0 As Int32 = 0
Friend dwReserved1 As Int32 = 0
<MarshalAs(Unm anagedType.ByVa lTStr, SizeConst:=MAX_ PATH)_
Friend fileName As String = Nothing
<MarshalAs(Unm anagedType.ByVa lTStr, SizeConst:=14)_
Friend alternateFileNa me As String = Nothing
End Class
/////

How can I make it so the FindNextFile call actually moves on to the next file in the
directory?

Lance



Aug 31 '06 #4

Lance wrote:
Hi All,

I'm working on a program that requires searching multiple drives for multiple file types
and cataloging them based on certain geospatial attributes. All together, there are
hundreds of thousands of files on the drives. As part of the process, I'm currently using
the GetFiles method of the FileSystem object to retrieve collection of strings
representing a collection of a particular file type (for example, tif files). The problem
is that the GetFiles method doesn't seem to make any callbacks that would allow for me to
show some sort of meaningful progress, and the process can take a very long time. I know
I could fudge it with a marquee style progress bar and\or a busy mouse icon, but this
isn't ideal.

So, I was looking into using the API to do the grunt work. This would allow me to at
least display each filename in a label control as the search is being performed. I'm
trying to port Randy Birch's VB6 code available on his website at
http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It's working
somewhat, except for the FindNextFile function which I've declared like so:

/////
Private Declare Function FindNextFile Lib "kernel32" _
Alias "FindNextFi leA" _
(ByVal hFindFile As Int32, _
ByVal lpFindFileData As WIN32_FIND_DATA ) As IntPtr
/////
The default in VB.NET functions is ByVal now rather then ByRef. If you
look at the original, your structure should be passed ByRef. Also, I
would not alias this function - it will cause you serious performance
issues on NT based systems (most current OS's :)

Your declares should probably look more like:

Private Declare Auto Function FindFirstFile Lib "kernel32" _
(ByVal lpFileName As String, _
ByRef lpFindData As WIN32_FIND_DATA ) As IntPtr

Private Declare Auto Function FindNextFile Lib "kernel32" _
(ByVal hFindFile As IntPtr, _
ByRef lpFindData As WIN32_FIND_DATA ) As IntPtr

Private Delcare Function FindClose Lib "kernel32" _
(ByVal hFindFile As IntPtr) As Boolean

--
Tom Shelton

Aug 31 '06 #5

Tom Shelton wrote:
Lance wrote:
Hi All,

I'm working on a program that requires searching multiple drives for multiple file types
and cataloging them based on certain geospatial attributes. All together, there are
hundreds of thousands of files on the drives. As part of the process, I'm currently using
the GetFiles method of the FileSystem object to retrieve collection of strings
representing a collection of a particular file type (for example, tif files). The problem
is that the GetFiles method doesn't seem to make any callbacks that would allow for me to
show some sort of meaningful progress, and the process can take a very long time. I know
I could fudge it with a marquee style progress bar and\or a busy mouse icon, but this
isn't ideal.

So, I was looking into using the API to do the grunt work. This would allow me to at
least display each filename in a label control as the search is being performed. I'm
trying to port Randy Birch's VB6 code available on his website at
http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It's working
somewhat, except for the FindNextFile function which I've declared like so:

/////
Private Declare Function FindNextFile Lib "kernel32" _
Alias "FindNextFi leA" _
(ByVal hFindFile As Int32, _
ByVal lpFindFileData As WIN32_FIND_DATA ) As IntPtr
/////

The default in VB.NET functions is ByVal now rather then ByRef. If you
look at the original, your structure should be passed ByRef. Also, I
would not alias this function - it will cause you serious performance
issues on NT based systems (most current OS's :)

Your declares should probably look more like:

Private Declare Auto Function FindFirstFile Lib "kernel32" _
(ByVal lpFileName As String, _
ByRef lpFindData As WIN32_FIND_DATA ) As IntPtr

Private Declare Auto Function FindNextFile Lib "kernel32" _
(ByVal hFindFile As IntPtr, _
ByRef lpFindData As WIN32_FIND_DATA ) As IntPtr
Crap messed up FindNextFile - it should return Boolean rather then
IntPtr.

--
Tom Shelton

Aug 31 '06 #6
Ok. Initially I pasted your API declares in my code and ran it. I was presented with a
"FatalExecution EngineError was detected" message from the MDA. So I changed the
WIN32_FIND_DATA from how it was originally posted as a class (and it *was* a class, not a
structure in my orginal post. I sent a reply to my original message saying it was a
structure <--wrong...ignore my own reply to the original please) to a structure as such:

////
Public Structure WIN32_FIND_DATA
Public sfileAttributes As Int32
Public creationTime_lo wDateTime As Int32
Public creationTime_hi ghDateTime As Int32
Public lastAccessTime_ lowDateTime As Int32
Public lastAccessTime_ highDateTime As Int32
Public lastWriteTime_l owDateTime As Int32
Public lastWriteTime_h ighDateTime As Int32
Public nFileSizeHigh As Int32
Public nFileSizeLow As Int32
Public dwReserved0 As Int32
Public dwReserved1 As Int32
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=MAX_ PATH)_
Public fileName As String
<MarshalAs(Unma nagedType.ByVal TStr, SizeConst:=14)_
Public alternateFileNa me As String
End Structure
////

and while now the FindNextFile API call works (yeah!), I don't think the structure is
correct. The filename member is always just the first character of the actual file name
(i.e., ReadMe.Txt is shown as "R") and the lowDates and highDates are too high for a
date-representing value.

Lance
"Tom Shelton" <to*@mtogden.co mwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
>
Tom Shelton wrote:
>Lance wrote:
Hi All,

I'm working on a program that requires searching multiple drives for multiple file
types
and cataloging them based on certain geospatial attributes. All together, there are
hundreds of thousands of files on the drives. As part of the process, I'm currently
using
the GetFiles method of the FileSystem object to retrieve collection of strings
representing a collection of a particular file type (for example, tif files). The
problem
is that the GetFiles method doesn't seem to make any callbacks that would allow for
me to
show some sort of meaningful progress, and the process can take a very long time. I
know
I could fudge it with a marquee style progress bar and\or a busy mouse icon, but this
isn't ideal.

So, I was looking into using the API to do the grunt work. This would allow me to at
least display each filename in a label control as the search is being performed. I'm
trying to port Randy Birch's VB6 code available on his website at
http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It's
working
somewhat, except for the FindNextFile function which I've declared like so:

/////
Private Declare Function FindNextFile Lib "kernel32" _
Alias "FindNextFi leA" _
(ByVal hFindFile As Int32, _
ByVal lpFindFileData As WIN32_FIND_DATA ) As IntPtr
/////

The default in VB.NET functions is ByVal now rather then ByRef. If you
look at the original, your structure should be passed ByRef. Also, I
would not alias this function - it will cause you serious performance
issues on NT based systems (most current OS's :)

Your declares should probably look more like:

Private Declare Auto Function FindFirstFile Lib "kernel32" _
(ByVal lpFileName As String, _
ByRef lpFindData As WIN32_FIND_DATA ) As IntPtr

Private Declare Auto Function FindNextFile Lib "kernel32" _
(ByVal hFindFile As IntPtr, _
ByRef lpFindData As WIN32_FIND_DATA ) As IntPtr

Crap messed up FindNextFile - it should return Boolean rather then
IntPtr.

--
Tom Shelton

Aug 31 '06 #7

Lance wrote:
Ok. Initially I pasted your API declares in my code and ran it. I was presented with a
"FatalExecution EngineError was detected" message from the MDA. So I changed the
WIN32_FIND_DATA from how it was originally posted as a class (and it *was* a class, not a
structure in my orginal post. I sent a reply to my original message saying it was a
structure <--wrong...ignore my own reply to the original please) to a structure as such:
Aaah! I didn't notice that you were using a class instead of a
structure. I will take a stab at doing an actual conversion of the
code this evening (no time right now) - unless someone else beats me to
it :)

--
Tom Shelton

Aug 31 '06 #8
Thanks Tom. Remember, WIN32_FIND_DATA as a class caused the "FatalExecution EngineError "
using your declarations, but as a structure, it was running (although the output of the
members didn't seem to jive).

Lance
"Tom Shelton" <to*@mtogden.co mwrote in message
news:11******** *************@i 3g2000cwc.googl egroups.com...
>
Lance wrote:
>Ok. Initially I pasted your API declares in my code and ran it. I was presented with
a
"FatalExecutio nEngineError was detected" message from the MDA. So I changed the
WIN32_FIND_DAT A from how it was originally posted as a class (and it *was* a class,
not a
structure in my orginal post. I sent a reply to my original message saying it was a
structure <--wrong...ignore my own reply to the original please) to a structure as
such:

Aaah! I didn't notice that you were using a class instead of a
structure. I will take a stab at doing an actual conversion of the
code this evening (no time right now) - unless someone else beats me to
it :)

--
Tom Shelton

Aug 31 '06 #9
"Lance" <nu***@business .comschrieb:
I'm working on a program that requires searching multiple drives for
multiple file types and cataloging them based on certain geospatial
attributes. All together, there are hundreds of thousands of files on the
drives. As part of the process, I'm currently using the GetFiles method
of the FileSystem object to retrieve collection of strings representing a
collection of a particular file type (for example, tif files). The
problem is that the GetFiles method doesn't seem to make any callbacks
that would allow for me to show some sort of meaningful progress, and the
process can take a very long time.
<URL:http://dotnet.mvps.org/dotnet/samples/filesystem/FileSystemEnume rator.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Sep 1 '06 #10

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

Similar topics

2
20218
by: Demetri | last post by:
Using the GetFiles method of the DirectoryInfo instance one can pass in a search pattern of string type. For example: DirectoryInfo di = new DirectoryInfo("C:\temp"); FileInfo fi = di.GetFiles("*.doc"); That code would return all the files with the doc extension in the C:\temp folder. No problem.
3
30590
by: S. Han | last post by:
I'm using Directory.GetFiles to enumerate files in a directory. The problem is if you have to enumerate all files + subdirectories recursively, it takes too much memory, and it fails. Is there another way to enumerate files and subdirectories recursively which doesn't take too much memory in CS?
2
5981
by: John Smith | last post by:
Hello all: I am trying to search for more than one extension in a directory at the same time with the following code: string files = Directory.GetFiles(sDir, "*.doc*.dot"); However, this does not work nor does something like this: string files = Directory.GetFiles(sDir, "*.doc, *.dot");
3
26140
by: philin | last post by:
Hi: I am using GetFiles() method of directory class to get some file names. I want to do know how i can setup search pattern strings to get multiple file types. Like: GetFiles(Path,"*.Txt") just gets txt files. I want to get txt and doc files together. Thank a lot for your help. philin
11
12507
by: al jones | last post by:
I'm using filesystem.getfiles - and so far it's working correctly *however* I'd sure like to be able to pass it, as the last parameter, the extensions (plural) for which I'm looking. I assumed that "*.exe, *.dll" for example would work but it seems to not like that syntax. Would someone correct my misinformation and give me a way to pass more than a single pattern to that last parameter?? Thanks //al
1
1898
by: Hawk | last post by:
I was writing my own wildcard compare algorithm and making a custom GetFiles routine when I came across what I think is a bug in .net's own GetFiles. My routine was coming up with different results than GetFiles so naturally I thought it was my routine that was bugged but when I investigated it the results from my algorithm where exactly what I would expect. call: System.IO.Directory.GetFiles("d:\\windows\\system32\\", "*ae?*.*",...
1
2557
by: jobs | last post by:
Say I only have a single file I want to get information on. How can I adapt this code? Dim dr As DataRow Dim fi As FileInfo Dim dir As New DirectoryInfo(filename) Dim dt As New DataTable dt.Columns.Add("FileName", GetType(String)) dt.Columns.Add("CeateTime", GetType(String)) dt.Columns.Add("Length", GetType(String))
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?
0
1372
by: tshad | last post by:
I am trying to do multiple Directory.GetFiles and append the results to one array that I will process. I tried this: string strFiles; strFiles = Directory.GetFiles(SemaSettings.InputFilePath, "GL*.*"); strFiles.CopyTo(Directory.GetFiles(SemaSettings.InputFilePath, "IN.*"),strFiles.Length-1); strFiles.CopyTo(Directory.GetFiles(SemaSettings.InputFilePath, "TX.*"),strFiles.Length-1,);
0
10504
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...
1
10251
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
10033
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
9085
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
7576
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
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
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.