[EMAIL PROTECTED] wrote:
And what a great tool VFS is :-) Just having some startup difficulties.
Thanks!
file = fsManager.resolveFile("/path/someDir");
remDir.copyFrom(file, new AllFileSelector());

Ok, the file I want to copy is the directory + content. Somehow it is only the
content of the dir that is copied?? How can i do this?
I am not sure if I understand you fully, but:

You do have a directory e.g.

/home/im/tmp/src
/home/im/tmp/src/file.txt
/home/im/tmp/src/dir/file2.txt

and your remDir is e.g. "/home/im/tmp/dest"

after the copyFrom you have
/home/im/tmp/dest
/home/im/tmp/dest/file.txt
/home/im/tmp/dest/dir/file2.txt

but you would like to have:
/home/im/tmp/dest/src
/home/im/tmp/dest/src/file.txt
/home/im/tmp/dest/src/dir/file2.txt

correct?


The following two code blocks will solve this:

---cut---
final FileObject foIN = VFS.getManager().resolveFile("/home/im/tmp/src/"); FileObject foOUT = VFS.getManager().resolveFile("/home/im/tmp/dst/");
       FileObject foOUT2 = foOUT.resolveFile(foIN.getName().getBaseName());
       foOUT2.copyFrom(foIN, new AllFileSelector());
---cut---

---cut---
final FileObject foIN = VFS.getManager().resolveFile("/home/im/tmp/src");
       FileObject foOUT = VFS.getManager().resolveFile("/home/im/tmp/dst");
       foOUT.copyFrom(foIN.getParent(), new FileSelector()
       {
public boolean includeFile(FileSelectInfo fileInfo) throws Exception
           {
return foIN.getName().isDescendent(fileInfo.getFile().getName(), NameScope.DESCENDENT_OR_SELF);
           }

public boolean traverseDescendents(FileSelectInfo fileInfo) throws Exception
           {
               return fileInfo.getDepth() == 0 || includeFile(fileInfo);
           }
       });
---cut---

Hope this helps!
---
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to