[Last Call] Learn how to a build a cloud-first strategyRegister Now


Windows 7, xcopy to samba share "Access denied"

Posted on 2009-12-31
Medium Priority
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
  • 2
  • 2
LVL 22

Expert Comment

ID: 26156911
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

ID: 26157185
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

Lars007 earned 0 total points
ID: 26157208
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

ID: 26180508
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....

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Suggested Courses

825 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