473,320 Members | 2,146 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,320 software developers and data experts.

Files

Hello,
I have a current directory and i want to retrive files drom Date A till
Date B. How can I do it in c#?
Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Dec 9 '06 #1
6 2199
csharpula csharp <cs*******@yahoo.comwrote:
I have a current directory and i want to retrive files drom Date A till
Date B. How can I do it in c#?
Use DirectoryInfo.GetFileSystemInfos, then use whichever property you
want (eg CreationTime, LastAccessTime etc) of each FileSystemInfo
returned to work out whether or not you're interested in it.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 9 '06 #2
Hi,

csharpula csharp wrote:
Hello,
I have a current directory and i want to retrive files drom Date A till
Date B. How can I do it in c#?
Thank you!
I don't think there is a built-in function for that. But it's easy
enough to do: Get all the files in the directory using
DirectoryInfo.GetFiles
http://msdn2.microsoft.com/en-us/lib....getfiles.aspx

Then loop through the found files, and check the dates using
FileInfo.CreationTime or FileInfo.LastWriteTime or
FileInfo.LastAccessTime (depending which you want)
http://msdn2.microsoft.com/en-us/lib...o_members.aspx

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 9 '06 #3
Hello,
All I can get from DirectoryInfo is DirectoryInfo.Equals and there is no
GetFiles.How to solve it?
(I can use Directory.GetFiles() but then I get strings(files names) and
not files eneries.
Thank you

*** Sent via Developersdex http://www.developersdex.com ***
Dec 10 '06 #4
Hello,
All I can get from DirectoryInfo is DirectoryInfo.Equals and there is no
GetFiles.How to solve it?
(I can use Directory.GetFiles() but then I get strings(files names) and
not files eneries.
Thank you

*** Sent via Developersdex http://www.developersdex.com ***
Dec 10 '06 #5
Hi,

GetFiles is an instance method, not a static method.

If you're using Visual Studio you can open the Object Browser, then enter
GetFiles into the search box. Find the method in the list of results,
select it, and look at the description pane below (notice that the "static"
keyword isn't present on any of the DirectoryInfo.GetFiles method
overloads).

--
Dave Sexton

"csharpula csharp" <cs*******@yahoo.comwrote in message
news:u4**************@TK2MSFTNGP03.phx.gbl...
Hello,
All I can get from DirectoryInfo is DirectoryInfo.Equals and there is no
GetFiles.How to solve it?
(I can use Directory.GetFiles() but then I get strings(files names) and
not files eneries.
Thank you

*** Sent via Developersdex http://www.developersdex.com ***

Dec 10 '06 #6
Hi,

csharpula csharp wrote:
Hello,
All I can get from DirectoryInfo is DirectoryInfo.Equals and there is no
GetFiles.How to solve it?
(I can use Directory.GetFiles() but then I get strings(files names) and
not files eneries.
Thank you
When I said "DirectoryInfo.GetFiles", I just meant the method GetFiles
of the DirectoryInfo class, which happens to be an instance method and
not a static method (as you would have seen if you had followed the link
provided). I agree that my notation was not the best.

First you create a new DirectoryInfo instance.
Then you use the GetFiles method.
And then you loop through them and check the dates.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 10 '06 #7

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

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
18
by: JKop | last post by:
Here's what I know so far: You have a C++ project. You have source files in it. When you go to compile it, first thing the preprocessor sticks the header files into each source file. So now...
3
by: pooja | last post by:
Suppose i have created a class c1 with f1()in c1.cpp and included this c1.cpp in file1.cpp file , which is also having main() by giving the statement #include "c1.cpp". the same i can do by...
11
by: ambika | last post by:
Iam just trying to know "c". And I have a small doubt about these header files. The header files just contain the declaration part...Where is the definition for these declarations written??And how...
22
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
18
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
0
by: wal | last post by:
How does one attach files to emails using libgmail? The following code http://pramode.net/articles/lfy/fuse/4.txt works fine when said files are simple text files, but it failes as soon as the...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.