[jcifs] Copying Files

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Thu Aug 16 08:13:44 EST 2001


> -----Original Message-----
> From:	Rob Wygand [SMTP:rob at filefish.com]
> Sent:	Wednesday, August 15, 2001 6:04 PM
> To:	jcifs at samba.org
> Subject:	[jcifs] Copying Files
> 
> Hello all,
> 
> Am I right in deducing that the only way to copy a file on a CIFS share 
> when using JCIFS is to open two SMBI/OStream's and copy the file byte by 
> byte from location a to location b?
> 
	Yes. Of course you should use an ample sized buffer.

> Does this mean that whenever I do such a copy that every byte of file a 
> is schlepped across to my machine then schlepped back to the remote 
> machine in the new location?
> 
	Yes. There is an SMB_COM_COPY command that will do this without going
	through the client (as long as the file is copied to the same host) but it is not
	supported by jCIFS at the moment. Actually the SMB_COM_COPY code is
	there (see SmbComCopy.jav) but I just never added a copyTo method because
	File and XFile etc didn't have it. It will be added to 0.6 but I want to optimise for 
	opying large quantities of files and directories across hosts (something most
	CIFS clients do no do or do not do well).

	Mike





More information about the jcifs mailing list