You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by richard head <du...@hotmail.com> on 2007/09/11 21:17:20 UTC

VFS copyFrom() Does Not Include Source in Directory Copy

In the javadocs for copyFrom() it says: "Copies another file, and all its 
descendents, to this file..."
This "another file"- the srcFile argument- should then be copied correct?

$ ls /cygdrive/c/in/
New Text Document.txt

$ ls /cygdrive/c/out/

Code:

//...
FileObject destFile = manager.resolveFile("C:\\out");
FileObject srcFile = manager.resolveFile("C:\\in");

destFile.copyFrom(srcFile,Selectors.SELECT_ALL);


$ java Bs

$ ls /cygdrive/c/out/
New Text Document.txt

As you can see, in is not a subdirectory of out. Are the docs wrong, or is 
this a bug?

Thanks.

_________________________________________________________________
Gear up for HaloĊ½ 3 with free downloads and an exclusive offer. 
http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: VFS copyFrom() Does Not Include Source in Directory Copy

Posted by richard head <du...@hotmail.com>.
>The javadocs say that the copyFrom() method will delete the
>destination directory ("this file") if it exists prior to the copy.
>So, I would think that would make it a true copy with no extraneous
>files left over from before the copy.  Right?

No, only files that exist in source dir will be deleted in the destination 
dir...
Although one could argue that the docs imply that...


>On 9/11/07, richard head <du...@hotmail.com> wrote:
> >
> > >I don't think this is a bug.  The c:\out directory now contains the
> > >same contents that the c:\in directory contained.  Therefore, c:\out
> > >is a copy of c:\in.
> >
> > In this case it is because c:\out contained no children prior to the
> > copyFrom() call.  If c:\out did contain children, copyFrom() would not
> > render c:\out as a copy of c:\in.
> >
> > >The copyFrom method doesn't copy the source file
> > >into the destination file.  It makes the destination file a copy of
> > >the source file.
> >
> > Humm, when you copy, you're copying a files contents. Directories 
>contents
> > are other files, so this does hold true, yet the destination directory 
>is
> > then not a copy, since any files that were in existence in the 
>destination
> > prior to the copy remain.
> >
> > In any case, the copyFrom() method takes a FileSelector, so what gets 
>copied
> > is at the callers discretion. In my case, I used Selectors.SELECT_ALL, 
>so
> > everything should be selected.
> >
> >
> > >On 9/11/07, richard head <du...@hotmail.com> wrote:
> > > > In the javadocs for copyFrom() it says: "Copies another file, and 
>all
> > >its
> > > > descendents, to this file..."
> > > > This "another file"- the srcFile argument- should then be copied
> > >correct?
> > > >
> > > > $ ls /cygdrive/c/in/
> > > > New Text Document.txt
> > > >
> > > > $ ls /cygdrive/c/out/
> > > >
> > > > Code:
> > > >
> > > > //...
> > > > FileObject destFile = manager.resolveFile("C:\\out");
> > > > FileObject srcFile = manager.resolveFile("C:\\in");
> > > >
> > > > destFile.copyFrom(srcFile,Selectors.SELECT_ALL);
> > > >
> > > >
> > > > $ java Bs
> > > >
> > > > $ ls /cygdrive/c/out/
> > > > New Text Document.txt
> > > >
> > > > As you can see, in is not a subdirectory of out. Are the docs wrong, 
>or
> > >is
> > > > this a bug?
> > > >
> > > > Thanks.
> > > >
> > > > _________________________________________________________________
> > > > Gear up for Halo(r) 3 with free downloads and an exclusive offer.
> > > > http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1
> > > >
> > > >
> > > > 
>---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > > > For additional commands, e-mail: user-help@commons.apache.org
> > > >
> > > >
> >
> > _________________________________________________________________
> > More photos; more messages; more whatever. Windows Live Hotmail - NOW 
>with
> > 5GB storage.
> > 
>http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_5G_0907
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
> >

_________________________________________________________________
Gear up for HaloĊ½ 3 with free downloads and an exclusive offer. 
http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: VFS copyFrom() Does Not Include Source in Directory Copy

Posted by James Carman <ja...@carmanconsulting.com>.
The javadocs say that the copyFrom() method will delete the
destination directory ("this file") if it exists prior to the copy.
So, I would think that would make it a true copy with no extraneous
files left over from before the copy.  Right?



On 9/11/07, richard head <du...@hotmail.com> wrote:
>
> >I don't think this is a bug.  The c:\out directory now contains the
> >same contents that the c:\in directory contained.  Therefore, c:\out
> >is a copy of c:\in.
>
> In this case it is because c:\out contained no children prior to the
> copyFrom() call.  If c:\out did contain children, copyFrom() would not
> render c:\out as a copy of c:\in.
>
> >The copyFrom method doesn't copy the source file
> >into the destination file.  It makes the destination file a copy of
> >the source file.
>
> Humm, when you copy, you're copying a files contents. Directories contents
> are other files, so this does hold true, yet the destination directory is
> then not a copy, since any files that were in existence in the destination
> prior to the copy remain.
>
> In any case, the copyFrom() method takes a FileSelector, so what gets copied
> is at the callers discretion. In my case, I used Selectors.SELECT_ALL, so
> everything should be selected.
>
>
> >On 9/11/07, richard head <du...@hotmail.com> wrote:
> > > In the javadocs for copyFrom() it says: "Copies another file, and all
> >its
> > > descendents, to this file..."
> > > This "another file"- the srcFile argument- should then be copied
> >correct?
> > >
> > > $ ls /cygdrive/c/in/
> > > New Text Document.txt
> > >
> > > $ ls /cygdrive/c/out/
> > >
> > > Code:
> > >
> > > //...
> > > FileObject destFile = manager.resolveFile("C:\\out");
> > > FileObject srcFile = manager.resolveFile("C:\\in");
> > >
> > > destFile.copyFrom(srcFile,Selectors.SELECT_ALL);
> > >
> > >
> > > $ java Bs
> > >
> > > $ ls /cygdrive/c/out/
> > > New Text Document.txt
> > >
> > > As you can see, in is not a subdirectory of out. Are the docs wrong, or
> >is
> > > this a bug?
> > >
> > > Thanks.
> > >
> > > _________________________________________________________________
> > > Gear up for Halo(r) 3 with free downloads and an exclusive offer.
> > > http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: user-help@commons.apache.org
> > >
> > >
>
> _________________________________________________________________
> More photos; more messages; more whatever. Windows Live Hotmail - NOW with
> 5GB storage.
> http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_5G_0907
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: VFS copyFrom() Does Not Include Source in Directory Copy

Posted by richard head <du...@hotmail.com>.
>I don't think this is a bug.  The c:\out directory now contains the
>same contents that the c:\in directory contained.  Therefore, c:\out
>is a copy of c:\in.

In this case it is because c:\out contained no children prior to the 
copyFrom() call.  If c:\out did contain children, copyFrom() would not 
render c:\out as a copy of c:\in.

>The copyFrom method doesn't copy the source file
>into the destination file.  It makes the destination file a copy of
>the source file.

Humm, when you copy, you're copying a files contents. Directories contents 
are other files, so this does hold true, yet the destination directory is 
then not a copy, since any files that were in existence in the destination 
prior to the copy remain.

In any case, the copyFrom() method takes a FileSelector, so what gets copied 
is at the callers discretion. In my case, I used Selectors.SELECT_ALL, so 
everything should be selected.


>On 9/11/07, richard head <du...@hotmail.com> wrote:
> > In the javadocs for copyFrom() it says: "Copies another file, and all 
>its
> > descendents, to this file..."
> > This "another file"- the srcFile argument- should then be copied 
>correct?
> >
> > $ ls /cygdrive/c/in/
> > New Text Document.txt
> >
> > $ ls /cygdrive/c/out/
> >
> > Code:
> >
> > //...
> > FileObject destFile = manager.resolveFile("C:\\out");
> > FileObject srcFile = manager.resolveFile("C:\\in");
> >
> > destFile.copyFrom(srcFile,Selectors.SELECT_ALL);
> >
> >
> > $ java Bs
> >
> > $ ls /cygdrive/c/out/
> > New Text Document.txt
> >
> > As you can see, in is not a subdirectory of out. Are the docs wrong, or 
>is
> > this a bug?
> >
> > Thanks.
> >
> > _________________________________________________________________
> > Gear up for Halo(r) 3 with free downloads and an exclusive offer.
> > http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
> >

_________________________________________________________________
More photos; more messages; more whatever. Windows Live Hotmail - NOW with 
5GB storage. 
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_5G_0907


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: VFS copyFrom() Does Not Include Source in Directory Copy

Posted by James Carman <ja...@carmanconsulting.com>.
I don't think this is a bug.  The c:\out directory now contains the
same contents that the c:\in directory contained.  Therefore, c:\out
is a copy of c:\in.  The copyFrom method doesn't copy the source file
into the destination file.  It makes the destination file a copy of
the source file.

On 9/11/07, richard head <du...@hotmail.com> wrote:
> In the javadocs for copyFrom() it says: "Copies another file, and all its
> descendents, to this file..."
> This "another file"- the srcFile argument- should then be copied correct?
>
> $ ls /cygdrive/c/in/
> New Text Document.txt
>
> $ ls /cygdrive/c/out/
>
> Code:
>
> //...
> FileObject destFile = manager.resolveFile("C:\\out");
> FileObject srcFile = manager.resolveFile("C:\\in");
>
> destFile.copyFrom(srcFile,Selectors.SELECT_ALL);
>
>
> $ java Bs
>
> $ ls /cygdrive/c/out/
> New Text Document.txt
>
> As you can see, in is not a subdirectory of out. Are the docs wrong, or is
> this a bug?
>
> Thanks.
>
> _________________________________________________________________
> Gear up for Halo(r) 3 with free downloads and an exclusive offer.
> http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org