Why can I create a remote directory through Windows Explorer, but not from the command prompt?

7

1

I'm using Windows 7 and have a remote folder available. Let's call it \\mycompany-portal\somefolder\attachments.

I can map a network drive to the folder root, so Z:\ points to \\mycompany-portal. I originally used the command prompt pushd \\mycompany-portal, however manual mapping through windows explorer makes no difference.

I note that the mapped drive is actually a DavWWWRoot

I can navigate to z:\somefolder\attachments in Windows Explorer and create a new folder therein successfully.

However, when I attempt to create a folder in this location from the cmd.exe command prompt using mkdir I get the error:

A device attached to the system is not functioning.

The mkdir command was mkdir 11112. The intention was for 11112 to be the Sharepoint call id. This fails, however mkdir blahblah works just fine in the command prompt

Why would this be?

James Wiseman

Posted 2014-03-13T16:12:07.137

Reputation: 366

1How exactly are you using 'mkdir'? Are you able to change to the Z: drive at all in the command prompt? Are you opening the command prompt "As Administrator" by any chance? – Ƭᴇcʜιᴇ007 – 2014-03-13T16:17:24.383

Yes, I'm able to change to the Z: in the command prompt. It doesn't matter if I'm running as administrator or not. The same happens either way. – James Wiseman – 2014-03-13T16:24:14.023

Not sure if it's relevant, but the remote location in question is a Sharepoint share. – James Wiseman – 2014-03-13T16:25:38.450

Can you provide the mkdir command you're using? – JSanchez – 2014-03-13T16:26:39.547

Interesting. The mkdir command was mkdir 11112. The intention was for 11112 to be the Sharepoint call id. This fails, however mkdir blahblah works just fine in the command prompt. Strange. – James Wiseman – 2014-03-13T16:31:25.483

What method is used to create the Z: map to the SharePoint server? you should edit that info from your last comment into the Question -- seems important. :) – Ƭᴇcʜιᴇ007 – 2014-03-13T16:35:54.690

I've edited accoringly. I originally used the command prompt pushd \mycompany-portal, however manual mapping through windows explorer also causes this to be displayed. – James Wiseman – 2014-03-13T16:47:02.020

I note that the mapped drive is actually a DavWWWRoot – James Wiseman – 2014-03-13T16:48:20.010

Microsoft's WebDAV support has always been hit-or-miss, particularly at the CLI. – Zoredache – 2014-03-13T17:38:10.123

Answers

0

The Sharepoint WebDAV folder in which I was trying to create the directory was itself linked to an 'Attachments' folder in Sharepoint. Each sub folder was named accordingly to the sharepoint ID number of the associated list.

The error occurred when trying to create a folder directly with a name comprising wholly of numbers. I'm still unsure as to why this might be.

Anyway, the reason it worked in Windows Explorer was that when creating a new directory there, Windows Explorer first creates a folder called "New Folder" and then renames it when you name it.

Trying this manually from the command prompt, i.e. mkdir xxxxx then rename xxxx 11112 demonstrated that it worked ok.

Given that this is WebDAV, all such requests are made through a RESTful API, so it is possible to sniff these with a packet sniffer (I used Fiddler). There I got a more indicative error message (though no more helpful).

Cannot create folder "somefolder/Attachments/1000001"

James Wiseman

Posted 2014-03-13T16:12:07.137

Reputation: 366