I am trying to move files from the RootFolder to a subfolder via PowerShell (would like to keep SPItem.Id from changing if possible). The code I have used is pretty straight forward. starting to think the file is moving but the item isn't, causing them both to corrupt & go missing. Still not sure.
$web = get-spweb http://mySPweb.com $list = $web.Lists["MyDocuments"] $DestUrl ="/MyDocuments/SubFolderName/myfile.docx" $file = $web.GetFile("/MyDocuments/myfile.docx") $file.moveTo($DestUrl,$true) $file.update()
I get no errors, the file object still exists. But checking via UI the folder is still empty
The process used by the administrators to restore the DB for testing, corrupted the files. The above code works.