I am using powershell to read a csv file and then uploading the file to sharepoint. However, I would like to rename the file. how is it done? Is it done before I load the file from fileshare to document library. or during the add method. I am not sure. Please let me know.
$sourceFile = Get-ChildItem $i.FileLocation
$newFile = $docLibrary.RootFolder.Files.Add($destinationFolderPath,$sourceFile.OpenRead(), $true)