[jcifs] Strange file copy problem

Michael B Allen miallen at ioplex.com
Thu Sep 13 22:28:27 GMT 2007


On Thu, 13 Sep 2007 07:49:03 -0400
"Hite, Sharon (NIH/NIEHS) [E]" <hite1 at niehs.nih.gov> wrote:

> I am trying to copy files from one server to another using JCIFS.  This
> normally works pretty well.  However, when the only thing that changes
> on the file is it's name, I can't get seem to overwrite the old file.
> For example, I have a file called CamelCase.txt that I copy from Server1
> to Server2.  Everything works fine.  I then change the name of the file
> to camelcase.txt on Server1 and copy it to Server2.  The code executes
> successfully, but I still see CamelCase.txt out on Server2.

Hi Sharon,

That exactly right. CIFS is case-insensitive. When you open camelcase.txt
and there's an existing file CamelCase.txt, the server will return a
handle to that existing file. Then copyTo will *truncate* and write the
new contents. If you really want the name to change you'll need to delete
the existing file first.

Mike

-- 
Michael B Allen
PHP Active Directory Kerberos SSO
http://www.ioplex.com/


More information about the jcifs mailing list