Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
    
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? –  BGM Aug 20 '13 at 13:34

3 Answers 3

up vote 5 down vote accepted

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.

share|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. –  BGM Aug 10 '12 at 13:37
    
Yep just in case :) –  Russell Aug 11 '12 at 11:37

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.

share|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 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? –  BGM Jan 4 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. –  BGM Jan 4 at 1:51

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

share|improve this answer
    
Thanks, but that's not quite what I had in mind. –  BGM 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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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