[ 
https://issues.apache.org/jira/browse/IO-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17179581#comment-17179581
 ] 

Gary D. Gregory commented on IO-684:
------------------------------------

The Apache Snapshot repository is here: 
https://repository.apache.org/content/repositories/snapshots

 

> Add force version of PathUtils.delete() APIs and friends.
> ---------------------------------------------------------
>
>                 Key: IO-684
>                 URL: https://issues.apache.org/jira/browse/IO-684
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.7
>            Reporter: Robin Jansohn
>            Priority: Major
>             Fix For: 2.8.0
>
>
> With the changes from IO-629 I'm getting an {{AccessDeniedException}} when 
> trying to recursively delete a directory with read-only files, e.g. a 
> {{.git}} repository. Before this change the directory was successfully 
> deleted. It is due to the difference between {{File.delete()}} and 
> {{Files.delete()}} (see https://stackoverflow.com/a/12234217/3375325).
> I think an option should be introduced to make the previous behavior 
> available again with an overloaded method like {{PathUtils.delete(Path path, 
> boolean force)}}.
> Stacktrace:
> {noformat}
> java.nio.file.AccessDeniedException: 
> C:\Users\xyz\AppData\Local\Temp\.git\objects\pack\pack-6576964fbde069f1787513ce358d2260530d5738.idx
>       at 
> sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
>       at 
> sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
>       at 
> sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
>       at 
> sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
>       at 
> sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
>       at java.nio.file.Files.deleteIfExists(Files.java:1165)
>       at 
> org.apache.commons.io.file.DeletingPathVisitor.visitFile(DeletingPathVisitor.java:99)
>       at 
> org.apache.commons.io.file.DeletingPathVisitor.visitFile(DeletingPathVisitor.java:35)
>       at java.nio.file.Files.walkFileTree(Files.java:2670)
>       at java.nio.file.Files.walkFileTree(Files.java:2742)
>       at 
> org.apache.commons.io.file.PathUtils.visitFileTree(PathUtils.java:535)
>       at 
> org.apache.commons.io.file.PathUtils.deleteDirectory(PathUtils.java:265)
>       at org.apache.commons.io.file.PathUtils.delete(PathUtils.java:254)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to