Forum Discussion
can PnpOnline script move files to a different library and retain same created and modified dates?
- Aug 02, 2025
The Move-PnPFile command automatically preserves metadata such as creator and time during migration.
Yes, it is possible to update the Created and Modified dates using PnP PowerShell.
In your scenario, you can first retrieve the original metadata (including Created and Modified dates) either by downloading it along with the file or directly querying it from the source SharePoint library. After uploading the file to the target location, you'll receive a new item ID. Using this ID, you can then update the Created and Modified dates via PnP PowerShell.
Set-PnPListItem -List <ListName> -Identity <ID> -Values @{
Created = "7/30/2025"
Modified = "7/29/2025"
}
While this approach requires an investment in scripting and setup, there are also SharePoint and commercial migration tools available that can simplify the process and may be worth considering depending on your needs.