如何使用PowerShell从SharePoint下载最新文件

时间:2015-03-09 16:05:47

标签: powershell sharepoint-2010 powershell-v2.0

我只是好奇,我是否有可能从SharePoint文档库下载文件?

问题是我在这个库中有3-4个文件,我需要获取最新修改日期的文件。

提前谢谢。

1 个答案:

答案 0 :(得分:0)

Refer to the link below, but instead of using the actual SharePoint URL for the directory use the File Explorer address for the SharePoint site.

Powershell Script:

$dir = "\\sharepoint.domain.com\site\Foo\SubFoo\SharedDocuments\Folder\"
$latest = Get-ChildItem -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 1
$latest.name

To get the explorer location, right click on a file link in SharePoint, (Firefox 'Copy link location', IE 'Properties').

Copy the URL: http://sharepoint.domain.com/site/Foo/SubFoo/SharedDocuments/Folder/

Change it this format: \\sharepoint.domain.com\site\Foo\SubFoo\SharedDocuments\Folder\

Verify the link works: Click 'Start' --> 'Run' --> paste the changed link and run it. It should open the SharePoint folder.

The PowerShell code came from this site.
Give them a check too: How to find newest file in directory using PowerShell script?