How do i delete files in particular directoryin ruby?

On 10/5/2010 8:10 AM, Amit T. wrote:

and I’m not certain that FileUtils has been written to perform such

Yaa Jeremy i really need do delete those file…

In my rails application i am uploading some large file (2gb) and while
doing mongrel +ruby temp file is being created ,ruby temp files is not
the problem because they are garbaselly collecting after upload but
mongerl temprary files are sitll holding memory
that is why iw ant to delete them only after i restart mongerl i get
ridoff those temp files but i don’t restart server

Unfortunately, either Mongrel or your application is still using those
files; otherwise, you would be able to delete the files on Windows.
Even on non-Windows then, deleting the files won’t reclaim the space
until after the program with the open file handles stops and releases
the files, so if consumption of disk space is your concern, you need to
find a way to close those files even if you manage to delete them.

I’m not familiar enough with Mongrel to give anything more than general
suggestions, so take this for what it’s worth. Confirm that your
application is not causing these files to be opened and never closed by
way of a long-lived File instance referenced in one of your objects.
Maybe you can boil down your application to just this upload feature and
use that as a simple test case to prove that Mongrel is the one holding
onto these files. If the temporary file really is created by Mongrel
itself, perhaps there is a configuration option to tell Mongrel to
periodically dump its temporary files and create new ones.

-Jeremy

On 10/5/2010 8:59 AM, Amit T. wrote:

cud you please provide me some good link where i can find more
information about mongrel like how it handles upoload or it do garbase
collection

I don’t know of any awesome Mongrel documentation myself. Sorry. Maybe
the folks on the Mongrel Users list
(http://rubyforge.org/mailman/listinfo/mongrel-users) can help more.

-Jeremy

On Tue, Oct 5, 2010 at 3:10 PM, Amit T. [email protected]
wrote:

Yaa Jeremy i really need do delete those file…

Why? Are you running into file system limitations due to size and
number of files? Or are you just offended by temporary files on
principle, like I am?

In my rails application i am uploading some large file (2gb) and while
doing mongrel +ruby temp file is being created ,ruby temp files is not
the problem because they are garbaselly collecting after upload but
mongerl temprary files are sitll holding memory
that is why iw ant to delete them only after i restart mongerl i get
ridoff those temp files but i don’t restart server

Does the Mongrel process handling the upload balloon up as well as
create a file that cannot be reclaimed?

If so, create a minimal app (as has been suggested), and see if you
can narrow down the problem. It is possible that a) either your Ruby
program is not garbage collected, or that Mongrel shows a strange bug
when dealing with large downloads.


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

Phillip G. wrote:

On Tue, Oct 5, 2010 at 3:10 PM, Amit T. [email protected]
wrote:

Yaa Jeremy i really need do delete those file…

Why? Are you running into file system limitations due to size and
number of files? Or are you just offended by temporary files on
principle, like I am?

In my rails application i am uploading some large file (2gb) and while
doing mongrel +ruby temp file is being created ,ruby temp files is not
the problem because they are garbaselly collecting after upload but
mongerl temprary files are sitll holding memory
that is why iw ant to delete them only after i restart mongerl i get
ridoff those temp files but i don’t restart server

Does the Mongrel process handling the upload balloon up as well as
create a file that cannot be reclaimed?

If so, create a minimal app (as has been suggested), and see if you
can narrow down the problem. It is possible that a) either your Ruby
program is not garbage collected, or that Mongrel shows a strange bug
when dealing with large downloads.


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

Phillip thanks for your response…
Actually ruby temporary file is garbaselly collected after upload
finishes but it mongrel temporary file who is giving trouble to me.
Am looking for
mongrel file which handle this garbase collection ,if i know about the
file i can do something