Windows 7, xcopy to samba share "Access denied"

Posted on 2009-12-31
Last Modified: 2013-12-09

I am trying to xcopy a directory tree from a local drive to a Samba share, but I am getting "Access denied.  Unable to create directory."  I have read & write access to the Samba share in question (as well as the proper underlying Linux permissions).

Let me give more details by example:

xcopy d:\bup\SomeDir SomeDir /e/s/h/k/r/c
Access denied
Unable to create directory - G:\all\SomeDir
0 File(s) copied

But the top level directory does get created (but nothing else):
G:\all>dir SomeDir
 Volume in drive G is groups
 Volume Serial Number is 800A-0BF7

 Directory of G:\all\SomeDir

12/31/2009  06:50 PM    <DIR>          .
12/31/2009  06:50 PM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  57,038,340,096 bytes free

If I perform the exact same operation from a Windows XP machine, logged in as the same exact user, it works just fine (I've used this command to backup and restore directories for more years than I care to remember).  

If I use Explorer to drag the directory to the network share instead, it works fine.  But I would much rather use the command line for this (and it should work!).  I looked at the switches for xcopy to see if there were any changes in Windows 7 version that could cause this, but did not see any that stood out as a potential culprit.

Samba server:
CentOS 3.9,  kernel 2.4.21-47.0.1.ELsmp

Windows workstation:
Windows 7 64 bit.

Any idea of what would be causing this issue?


Ps. I realize CentOS 3.9 and samba-3.0.9 are old, but I do not have the choice of upgrading this particular server.
Question by:Lars007
    LVL 22

    Expert Comment

    You will need to run one xcopy followed by the /T /E switches so it copies the directory structure and the empty directories as well.
    I am not sure if you can run it followed by the rest of the switches and if it will copy the files if run with the rest of the switches. I haven't tested it but I suppose it should otherwise you should be able to create a batch file with something like:
    xcopy d:\bup\SomeDir /T /E
    xcopy d:\bup\SomeDir SomeDir /e/s/h/k/r/c

    Author Comment

    No, "/E/T" is to create the directory structure *without* copying any files (and it gives the same access denied error).  "/E/S" are the proper switches to create the directory structure as well as copy the files.



    Accepted Solution

    I found the problem - the workgroup had a mistake in it.  It did not even occur to me to double-check that since everything else except for the xcopy command was working just fine (I've been reading and writing files to this Samba server for weeks w/o issues up till now).  Maybe the combination of Windows 7 and my Samba version resulted in full (but slightly broken) access despite the workgroup mismatch.

    LVL 22

    Expert Comment

    I've had problems before on a domain when I do not create the directory structure "beforehand".... The problems only happen the first time, once the directory structure is in place it works great.
     I'm glad to hear you solved the problem on your side....

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Image capture and Deploy method is consist on two phases. In our first phase we capture the image of windows from the PC in which Windows and others softwares are already installed. In second phase we deploy the created image on new PC in which we…
    If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
    This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
    The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now