Forum Discussion
Migrate file shares to sharepoint online
Hi, you can refer the below TechNet gallery script. HTH.
https://gallery.technet.microsoft.com/Bulk-upload-the-files-from-8932fc26#content
- Dhanushka VithanageMar 19, 2017Brass Contributor
Thanks Santosh, do you know if this method can move a large number of files/folders (over 200 GB) and will it retain file/folder attributes and metadata?
-Dhanushka
- SanthoshB1Mar 22, 2017Bronze Contributor
This script uses pnp which supports a single file size up to 250 mb and the file size will be calculated individually. So you dont need to worry about the total size of the library. We have modified the script to support meta details. You can use below script. Please be noted that you need to create the meta data columns in the destination document library.
Example:
"createdate"
"modifieddate"
"owner"$cred=Get-Credential $makeUrl ="https://<tenantname>.sharepoint.com/sites/contosobeta" $sourcePath = "<FolderPath>\"; $topSPOFolder = "Shared Documents"; # install pnp powershell..? #Install-Module SharePointPnPPowerShellOnline # connect to spo online Connect-PnPOnline -Url $makeUrl -Credentials $cred $fileNames = Get-ChildItem -Path $sourcePath -Recurse ; foreach($aFileName in $fileNames) { if($aFileName.GetType().Name -ne "DirectoryInfo") { $filepath= [System.IO.Path]::GetDirectoryName($aFileName.FullName) $Urlpath= ($filepath.Replace($sourcePath, '')); $foldername=$Urlpath.Replace("/","\"); $fn=$topSPOFolder+"\"+$foldername; $metadata = @{ "createdate" = $aFileName.CreationTime "modifieddate" = $aFileName.LastWriteTime "owner"= $aFileName.GetAccessControl().Owner } Add-PnPFile -Path $aFileName.FullName -Folder $fn -Values $metadata; $fn=$null } }
If you have files sized more than 250 mb please let me know.
- syed mustafaApr 20, 2017Copper Contributor
hI Santhosh,
We have 2 TB files in on-prem. we need to migrate files to sharepoint 2016.
Kindly help me.