473,387 Members | 1,303 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,387 software developers and data experts.

Get n number of Files from directory

bhu
Hi
any idea how to get a set of files from a Directory,
if a Directory contains 100 files i want to access 10 file at a time move it
to a different directory , grab the next 10 do the same,
Also is there a way to get the First Set of File by the Date and time Stamp
FIFO
thanks
bhu
Jun 26 '06 #1
5 1787
>Also is there a way to get the First Set of File by the Date and time Stamp
FIFO


Read the file information (file name and date/time) for all files in
the directory into a list. Sort by file time. Process in batches of
ten. It doesn't have to be more complicated than that. If you have
further questions on how to implement one of those steps, feel free to
follow up with a more detailed question.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jun 26 '06 #2
bhu
This way i already have it, but
i was expecting in a single function where we could say get 10 file,
thanks for the info.

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
Also is there a way to get the First Set of File by the Date and time
Stamp
FIFO


Read the file information (file name and date/time) for all files in
the directory into a list. Sort by file time. Process in batches of
ten. It doesn't have to be more complicated than that. If you have
further questions on how to implement one of those steps, feel free to
follow up with a more detailed question.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Jun 27 '06 #3
Blu,

I am curious what is in your idea the advantage of that? Will you tell us
that?

Cor

"bhu" <bh**********@hotmail.com> schreef in bericht
news:ev**************@TK2MSFTNGP02.phx.gbl...
This way i already have it, but
i was expecting in a single function where we could say get 10 file,
thanks for the info.

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>Also is there a way to get the First Set of File by the Date and time
>Stamp
FIFO


Read the file information (file name and date/time) for all files in
the directory into a list. Sort by file time. Process in batches of
ten. It doesn't have to be more complicated than that. If you have
further questions on how to implement one of those steps, feel free to
follow up with a more detailed question.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Jun 27 '06 #4
bhu
when i saw that we can get the file list by pattern *.xml , i was expecting
some thing simlar, which will also take the number of files as parameter and
possibly the order by Date.
Basically what i want to do is Process A will poll the directory for Files,
let us say 100 Files are there in the system, it will take the 10 Files and
give it to 10 Threads for the work to be done with the file and move the
files to some other Directory once Finished. Process A will poll after say 1
min to get the next set of files but it should fetch only 10 - (Finished
thread say this is 6)
so we need to fetch 4 Files and give it to 4 more threads, and the process
continues.( only 10 thread should be running a a time).

These are the issues Process A could pick the Same File that one of the
thread is using (this can be avoided by changing the file name by the
thread).
I hope i have explained what i am trying to do.
thanks
bhu

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Blu,

I am curious what is in your idea the advantage of that? Will you tell us
that?

Cor

"bhu" <bh**********@hotmail.com> schreef in bericht
news:ev**************@TK2MSFTNGP02.phx.gbl...
This way i already have it, but
i was expecting in a single function where we could say get 10 file,
thanks for the info.

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>Also is there a way to get the First Set of File by the Date and time
>Stamp
FIFO

Read the file information (file name and date/time) for all files in
the directory into a list. Sort by file time. Process in batches of
ten. It doesn't have to be more complicated than that. If you have
further questions on how to implement one of those steps, feel free to
follow up with a more detailed question.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.



Jun 27 '06 #5
Bhu,

Using threads in file processing can only lead to one thing: Rumbling of
your disk, and much more time needed for the process to finish.

This is typical a kind of process that you should not do with
multithreading.

You can poll 10 websites and than retrieve the data using multithreading,
mostly will that give as your own internet is wide enough benefit, but with
one disk (and you are talking about folders so it is one disk) it is contra
productive.

Cor

"bhu" <bh**********@hotmail.com> schreef in bericht
news:Ol**************@TK2MSFTNGP03.phx.gbl...
when i saw that we can get the file list by pattern *.xml , i was
expecting some thing simlar, which will also take the number of files as
parameter and possibly the order by Date.
Basically what i want to do is Process A will poll the directory for
Files, let us say 100 Files are there in the system, it will take the 10
Files and give it to 10 Threads for the work to be done with the file and
move the files to some other Directory once Finished. Process A will poll
after say 1 min to get the next set of files but it should fetch only
10 - (Finished thread say this is 6)
so we need to fetch 4 Files and give it to 4 more threads, and the process
continues.( only 10 thread should be running a a time).

These are the issues Process A could pick the Same File that one of the
thread is using (this can be avoided by changing the file name by the
thread).
I hope i have explained what i am trying to do.
thanks
bhu

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Blu,

I am curious what is in your idea the advantage of that? Will you tell us
that?

Cor

"bhu" <bh**********@hotmail.com> schreef in bericht
news:ev**************@TK2MSFTNGP02.phx.gbl...
This way i already have it, but
i was expecting in a single function where we could say get 10 file,
thanks for the info.

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>Also is there a way to get the First Set of File by the Date and time
>Stamp
>FIFO

Read the file information (file name and date/time) for all files in
the directory into a list. Sort by file time. Process in batches of
ten. It doesn't have to be more complicated than that. If you have
further questions on how to implement one of those steps, feel free to
follow up with a more detailed question.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.



Jun 28 '06 #6

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

Similar topics

3
by: David T. Ashley | last post by:
Hi, PHP allows the "library" which can contain an arbitrary number of include files. Can I put all the include files right in this directory, or should I create subdirectories? My question...
4
by: Bart Plessers \(artabel\) | last post by:
Hello, I have an asp script that lists the files in a directory: CurrentPATH = "c:\temp\" Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFolder = oFSO.GetFolder(CurrentPATH) Set...
2
by: Amy L. | last post by:
I am working on some code that will be used in a Windows Service that will monitor specific files in a queue. I would like to get an integer value of the amount of specfic files in a directory. ...
2
by: 73blazer | last post by:
Hello, I'm writing some C++ code, and I need to be able to find the number of files in a given directory. Is it possible under AIX4.3.3 with C++ 3.6.4? I cannot seem to locate anything of this...
1
by: supster | last post by:
EDIT: I no longer need only specific file types in a directory, just the total number of files! Is there a more efficient way other than this: string files = Directory.GetFiles(path); count =...
1
by: jj | last post by:
Hi folks: I can get the list of files in a certain directory by using Directory.GetFiles("c:\temp"). But I want to get the number of files (ex. 20) within a directory including all...
1
by: sasikumar | last post by:
i have created a new folder inside project(say update for storing update files for software) how can i get total number of files in that folder.what will be full path for accessing that...
8
by: theCancerus | last post by:
Hi All, I am not sure if this is the right place to ask this question but i am very sure you may have faced this problem, i have already found some post related to this but not the answer i am...
1
by: briggs | last post by:
Hi All, I need to take the count of txt and bak files present in all the directory.for eg if we assume there are two directoies say(test1, test2), I need to collect the count(of txt and bak files)...
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: 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
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.