Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble with File delete() method on Win XP  RSS feed

 
Carey Brown
Saloon Keeper
Posts: 2540
33
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a large project that is built using ANT (all of which I inherited). During the build a temp directory is created and several jar files are copied there from other projects.

The problem started with the ANT 'clean' target not being able to delete these files. So I wrote a couple of lines of Java which open the temp directory and loop through the files to delete them. The delete() method of File was returning false. So I added a security check above it and it through an exception saying that I had no access permission.

Next step was to use Windows Explorer to see if these were read only. When I looked at the properties for the files they were not marked as 'read only'. The directory that contains them, however, had the 'read only' check box with a light gray square in it (no actual check mark).

Next I used the command line 'attrib' command to see if they were hidden or system. Nope.

However, I CAN delete them using the DEL command or right-clicking with Windows Explorer and selecting Delete (?).

I rebooted to make sure no zombie processes were holding on to them. No luck. I did a file system check. No luck.

We use Subversion for the project with Tortoise SVN installed on our XP boxes. I am set up with administer privileges on my machine. Tortoise SVN clearly indicates that the temp directory is not part of the Subversion collection.

If anyone can shed some light on this I would be extremely grateful.

Ultimately I would like ANT to work like it should, but I would also like to update my Java utility so that it could handle this scenario.

Carey
 
Carey Brown
Saloon Keeper
Posts: 2540
33
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the delete() method that I wrote inside my utility.

 
Rob Spoor
Sheriff
Posts: 20904
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to I/O.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!