TrueVFS is unable to remove the file after unmount and throws the following exception.
java.nio.file.DirectoryNotEmptyException: tar:file:/D:/tmp/0554de32-5a95-4b58-a05d-d12effa68abc.tar!/ at net.java.truevfs.kernel.impl.ArchiveFileSystem.unlink(ArchiveFileSystem.scala:326) at net.java.truevfs.kernel.impl.BasicArchiveController.unlink(BasicArchiveController.scala:222) at net.java.truevfs.kernel.impl.DefaultManager$BackController.net$java$truevfs$kernel$impl$CacheController$$super$unlink(DefaultManager.scala:39) at net.java.truevfs.kernel.impl.CacheController$class.unlink(CacheController.scala:105) at net.java.truevfs.kernel.impl.DefaultManager$BackController.net$java$truevfs$kernel$impl$SyncController$$super$unlink(DefaultManager.scala:39) at net.java.truevfs.kernel.impl.SyncController$$anonfun$unlink$1.apply$mcV$sp(SyncController.scala:100) at net.java.truevfs.kernel.impl.SyncController$$anonfun$unlink$1.apply(SyncController.scala:98) at net.java.truevfs.kernel.impl.SyncController$$anonfun$unlink$1.apply(SyncController.scala:98) at net.java.truevfs.kernel.impl.SyncController$class.net$java$truevfs$kernel$impl$SyncController$$apply(SyncController.scala:119) at net.java.truevfs.kernel.impl.SyncController$class.unlink(SyncController.scala:98) at net.java.truevfs.kernel.impl.DefaultManager$BackController.net$java$truevfs$kernel$impl$LockController$$super$unlink(DefaultManager.scala:39) at net.java.truevfs.kernel.impl.LockController$$anonfun$unlink$1.apply$mcV$sp(LockController.scala:92) at net.java.truevfs.kernel.impl.LockController$$anonfun$unlink$1.apply(LockController.scala:92) at net.java.truevfs.kernel.impl.LockController$$anonfun$unlink$1.apply(LockController.scala:92) at net.java.truevfs.kernel.impl.LockingStrategy.apply(LockingStrategy.scala:84) at net.java.truevfs.kernel.impl.LockController$class.unlink(LockController.scala:92) at net.java.truevfs.kernel.impl.DefaultManager$BackController.unlink(DefaultManager.scala:39) at net.java.truevfs.kernel.impl.ArchiveControllerAdapter.unlink(ArchiveControllerAdapter.scala:35) at net.java.truevfs.kernel.spec.FsDecoratingController.unlink(FsDecoratingController.java:111) at net.java.truevfs.kernel.impl.FalsePositiveArchiveController$$anonfun$1.apply(FalsePositiveArchiveController.scala:132) at net.java.truevfs.kernel.impl.FalsePositiveArchiveController$$anonfun$1.apply(FalsePositiveArchiveController.scala:131) at net.java.truevfs.kernel.impl.FalsePositiveArchiveController$TryChild$.apply(FalsePositiveArchiveController.scala:195) at net.java.truevfs.kernel.impl.FalsePositiveArchiveController.unlink(FalsePositiveArchiveController.scala:143) at net.java.truevfs.access.TFile.rm(TFile.java:2216) at net.java.truevfs.access.TFile.rm(TFile.java:2195
The tar file is successfully created, so no issues with that.
Here is what I am doing.
Configure the True VFS
TConfig config = TConfig.current(); config.setArchiveDetector(new TArchiveDetector("tar", new TarDriver()));
Create the tar
Unmount the tar
TVFS.umount(tarFile);
convert into bytes and send it.
Remove the file
tarFile.rm()
I also tried tarFile.rm_r() and plain java.io.File.delete(). But none of them are working.
Can some one please advice me what went wrong? Thanks in advance.
TrueVFS abstracts the TAR file into a virtual directory, so you can only remove it if it's empty. To recursively remove a (virtual) directory with all its members, just call TFile.rm_r()
. You said you tried that, but maybe there was a side effect of your previous attempts, so I suggest to repeat it and see how far it gets you.