tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Fernández <>
Subject Re: File Deletion----not working
Date Fri, 19 Jan 2001 15:05:34 GMT
Hi, Deepak.

Deepak C S wrote:

> hi,
>         I am trying to delete a file under filesystem in a bean using:

Which filesystem?

>         File f=new File(path-to-file);
>         f.delete();

delete() returns a boolean; you should always check it to be true, since
otherwise you cannot be sure the file was deleted. Something like:
        if (!file.delete())
            throw new Exception ("File couldn't be deleted!");

>         But the File isnt getting deleted...Can anybody help??

I had a similar problema on Win2000. The files still cannot be deleted, so
I don't know what I should do -- theoretically, it shouldn't be a
permission-related problem since I do it from within a servlet. The same
code on Solaris works fine.

Now, if you're on Unix, then check it's not a directory full of things,
you have permissions, etc.



View raw message