4

I'm using wget 1.10.2 which doesn't have the auth problem, what I'm getting is when I run:

wget --user=myname --password=pwd http://the.sharepoint.link

it only downloads an aspx file which is the page's content.

How could I download the exact files?

2
  • what is your script environment? – Steve B Jul 19 '12 at 10:31
  • script environment? I'm using windows xp, and using wget for windows the version of wget is 1.10.2 – shengy Jul 23 '12 at 1:25
2

I solved it this way :

  1. Installed export cookies add-on for my browser,
  2. Logged into the Sharepoint website
  3. Exported the cookie into a file named cookie.txt
  4. then run the following command line with wget :

    wget --cookies=on --load-cookies cookies.txt --keep-session-cookies -m https://yoursharepoint.com 
    
1
  • To download a specific subdomain without mirroring the whole site wget --cookies=on --load-cookies cookies.txt --keep-session-cookies -r -np -R "index.html*" http://the.sharepoint.link/some/subdir/ from stackoverflow.com/questions/273743/… – alvas Nov 15 '17 at 7:49
1

You can tell wget to follow links, only go one level deep and not visit external sites. You do however need to have links to the documents on the page you start with otherwise it won't grab the files. Remember wget is essentially a html scraper, it isn't going to be able to view the contents of SharePoint as a directory unless rendered like that on the page.

1
  • wget -r -l 1 -A doc http://our.sharepoint.com/Folder this will miss some files. Don't know why, I solved the problem using chrome's Download Master plugin. – shengy Jul 23 '12 at 1:28
0

Once you have the link for the shared file or folder you got something ending in a web page direct linke i.e.:

https://my.domain.com/:u:/s/sitename/subsitename/YUjh87ybrkZMqwpwtNbux-7BYibztgMS3Q9IVmyd-BOsg?e=3sQsq1

All you need to do is to change the ending part to download=1 after the URL arguments ? finally you will get something like this:

https://my.domain.com/:u:/s/sitename/subsitename/YUjh87ybrkZMqwpwtNbux-7BYibztgMS3Q9IVmyd-BOsg?download=1

in powershell 3 this would work:

iwr -outfile file.zip https://my.domain.com/:u:/s/sitename/subsitename/YUjh87ybrkZMqwpwtNbux-7BYibztgMS3Q9IVmyd-BOsg?download=1

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.