Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

unable to delte directory

 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I created directory in “java.io.tmpdir”



after finish working with the files I want to delete the directory like this:

I don’t know why but I am unable to delete the directory since there are always few remaining files.

I try to first clean the directory but still not working.
Since most of the files are deleting successfully I dint think its related to authorization problems.

Any suggestions ?

Thanks
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chen yan wrote:I don’t know why but I am unable to delete the directory since there are always few remaining files.


That's the answer right there. You can't delete a directory unless it's empty.
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Question : )

anyways.. I suppose you should be looking for recursive deletion for files and the directory after...
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I don’t think you understand my description

1)As far I know FileUtils.deleteDirector(<dir>) ,is a recursively delete
FileUtils (Commons IO 1.4 API)
2)I wrote
I try to first clean the directory
meaning ,delete all the files in the current directory.

Thanks any why
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps one of the files in the directory is locked, and cannot be deleted. That means the entire deletion fails.
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't get it,

chen yan wrote: I try to first clean the directory but still not working.


Why are you again trying to clean up the directory if you are using commons.io FileUtils. that does all the work.

The only reason I can predict is "file / stream not getting closed".
Are you closing all the streams and files you open ?

If you are not sure.. could you post some code for

----->
chen yan wrote: after finish working with the files I want to delete the directory like this:


workin with the files ?

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!