Salvete! How can I, from the commandline, upload a file to a document library? Now, I found davcopy, which works, sort of. I can only upload the file using my domain account that I am already logged in with. If I give credentials (even my own!) the fail.

But I am not attached to davcopy. Maybe there is another way to do this from the commandline? I do want to avoid powershell, because I need to provide a way for this to be done to certain users who don't have powershell.

I am thinking it could be done using some sort of dav service.

  • It is not working for me at all... Can anybody help.... Showing message in cmd : Syntax is not correct – user19021 Aug 20 '13 at 7:12
  • Well, what is your commandline? – bgmCoder Aug 20 '13 at 13:34
  • I think he was missing /user: – grisha Sep 23 '14 at 13:39

Believe it or not, you can use Windows net use to map a sharepoint library to a drive letter! Then you can use plain old copy or xcopy or whatever.

net use r: https://some.portal.org/documents [password] user:domainName\[username]
copy c:\somefile.txt r:\somefile.txt

Here is where I found that answer. I've done this, and it works like a charm. You can even specify whatever credentials you like, too.

| improve this answer | |
  • This is also the equivalent of using Windows Explorer and Map Network Drive R:\. – Russell Aug 10 '12 at 4:33
  • Yes, that's true, but the ideas was to do this from the commandline. – bgmCoder Aug 10 '12 at 13:37
  • Yep just in case :) – Russell Aug 11 '12 at 11:37
  • I don't think this works with Sharepoint Online now. – bgmCoder Jun 1 at 15:26

you can also just call the DavWWWRoot as well.

so your url to your library is something like http://sharepoint/Site/SubSite/Library

your copy command would be copy somefile.txt \\sharepoint\DavWWWRoot\Site\SubSite\Library

Should work like a charm.

Edit. You will have to have at least one active File Explorer Connection to somewhere for this to work.

| improve this answer | |
  • Welcome to the StackExchange community! This sounds like a good answer, do you know of any documentation to support it? I could see that being very useful to other people who come across this question. – thanby Jan 3 '14 at 17:33
  • I tried just what you did, and got the response The system cannot find the path specified. Maybe this only works on the server? How can my computer know that \\sharepoint is a web address and NOT a network computer? – bgmCoder Jan 4 '14 at 1:47
  • I tried it on the server and the response was 1 file(s) copied - so something happened! But I can't find the file anywhere.... I don't know what it did do. – bgmCoder Jan 4 '14 at 1:51

You may want to check out Sync FileSystem and SharePoint List on codeplex

| improve this answer | |
  • Thanks, but that's not quite what I had in mind. – bgmCoder Aug 10 '12 at 3:10
  • @ashis-patel please add a good summary of your answer and then link. "link only answers" is of less use for our site, since links tend to die. – Anders Rask Aug 20 '13 at 8:37
  • Yes, that makes sense. I will keep that in mind. – Ashish Patel Aug 21 '13 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.