Hi Eric!
With commons-vfs RC6, I experience sometimes the following exception :
Could not write to "file:///tmp/test/file3.txt" because it is read-only.
This again has something to do with the internal vfs cache.
throws Exception {
FileSystemManager fsManager = VFS.getManager();
FileObject file1 = fsManager.resolveFile("/tmp/file1.txt");
FileObject file2 = fsManager.resolveFile("/tmp/file2.txt");
new File("/tmp/test/").mkdirs();
FileObject file3 = fsManager.resolveFile("/tmp/test/file3.txt");
FileUtil.copyContent(file1, file3);
new File("/tmp/test/file3.txt").delete();
new File("/tmp/test/").delete();
new File("/tmp/test/").mkdirs();
file3 = fsManager.resolveFile("/tmp/test/file3.txt");
file3.close();
FileUtil.copyContent(file2, file3);
This will force vfs to refresh its internal states and then it works.
PS: instead of FileUtils you might use
file3.copyFrom(file2, Selectors.SELECT_SELF);
In your case it will do the same, but that way you can also copy
directroies or apply a file filter ...
---
Mario
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]