Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Problem in getting files in a directory

 
Thread Tools Search this Thread
Old 11-06-2009, 02:27 PM   #1
Default Problem in getting files in a directory


Hi,

We are getting "Out of Memory" exception while using Directory.GetFiles()
method if there are large number of files present in the directory on which
the method is being executed.

We would like to have an alternate solution for picking files from the
directory, like picking only 10 or 15 files at a time.

Is there anything in GetFiles() method with which we can tweak in its
functionality to pick only a certain number of files? Or if there's an
alternate solution for the same, please do let us know.



Thanks,

Hemant




Hemant
  Reply With Quote
Old 11-06-2009, 02:34 PM   #2
Gregory A. Beamer
 
Posts: n/a
Default Re: Problem in getting files in a directory
"Hemant" <> wrote in news:eUwLlzuXKHA.1372
@TK2MSFTNGP02.phx.gbl:

> Is there anything in GetFiles() method with which we can tweak in its
> functionality to pick only a certain number of files? Or if there's an
> alternate solution for the same, please do let us know.


Are you using Directory or DirectoryInfo. the info classes are much less
weighty. I am not sure this will solve the problem, as both should just
get the names.

In the 4.0 Framework, there are more efficient file manipulation
methods, but that means heading into a beta to get your answer. There is
a "Go Live" on beta 2, but it is still beta.

Peace and Grace,

--
Gregory A. Beamer

Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************


Gregory A. Beamer
  Reply With Quote
Old 11-07-2009, 07:01 AM   #3
Hemant
 
Posts: n/a
Default Re: Problem in getting files in a directory
Hi,
Actually, in our case, its more than 5000 files that client puts in the
directory and after that our windows service picks up those files to
process.


Also, the search criteria filter does not help much because the filenames
are almost similar i.e. starting with same letters/words.

Is there any other option that we can use to avoid this memory issue?

thanks,
Hemant

"Mark Rae [MVP]" <> wrote in message
news:...
> "Hemant" <> wrote in message
> news:...
>
>> We are getting "Out of Memory" exception while using Directory.GetFiles()
>> method if there are large number of files present in the directory on
>> which the method is being executed.
>>
>> We would like to have an alternate solution for picking files from the
>> directory, like picking only 10 or 15 files at a time.

>
> There isn't anything like the equivalent of the command line /p switch...
>
> However, have you tried using filters to grab all of the files beginning
> with 'A', and then all of the files beginning with 'B', etc...?
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net





Hemant
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Temporary Internet Files directory Bluuuue Rajah Computer Support 16 10-21-2008 12:33 PM
Having problem downloading big files !! Help !!! hsyq8xg@gmail.com Computer Support 0 04-19-2008 10:44 PM
undo for scandisk? it trashed my files. NewB Computer Support 1 11-29-2006 09:08 AM
Re: Pen Drive Problem Reading Files Kadaitcha Man Computer Information 2 01-25-2005 10:48 PM
opening shared files problem Li'l Roberto Wireless Networking 0 07-02-2004 04:05 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46