Forums Register Login

unable to delte directory

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
Good Question : )

anyways.. I suppose you should be looking for recursive deletion for files and the directory after...
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Perhaps one of the files in the directory is locked, and cannot be deleted. That means the entire deletion fails.
+Pie Number of slices to send: Send
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 ?

a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1015 times.
Similar Threads
Saving a resource on a client--best practices question
deleting directory
java.io.FileNotFoundException: (Access is denied)
Compress .zip using Java
creation and deletion of files and folders.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:42:39.