Using a simple PowerShell script to move project data (folders/files) into ProjectWise. Whilst this works and imports ok, is there a way to keep the original Date Modified and Date Created? When importing all date attributes get stamped xx xx xxxx xx:xx 'time of import'.
Thanks in advance
You can use Import-PWDocumentsBySpreadsheet to do this. Create the spreadsheet with Save-PWDocumentReport and then edit it as needed. Then use Import-PWDocumentsBySpreadsheet to import them into your datasource.
Dan WilliamsSolution ConsultantBentley Systems, IncorporatedPortland, OR, USA (Pacific Time UTC-08:00)
Thanks for taking the time to reply. I am not sure the spreadsheet is an option for tens of thousands of files, might take awhile but will have a look at how it works.
ProjectWise is new to us, It would be simple if it would just retain the dates when importing! But I subsequently realized the same behaviour exists when you drag and drop files. It takes on the time copied as dates.
You didn't mention HOW you were importing your files in your original post (a common shortcoming, in the future please provide as much information as if you were trying to troubleshoot the issue for someone else).
So, not knowing what you did to import the files into your datasource, have you tried using Import-PWDocuments?
As a test, I just imported some text files from my hard drive using this Cmdlet, and the results retained the created dates on the documents and files. The updated date was set to when I imported the documents for the Document updated date, but kept the file updated date from the file system.
Here's what I used (Tip: using -Verbose can help you spot issues):
Import-PWDocuments -InputFolder c:\temp -DefaultEnvironment Simple -DefaultStorage Storage -ExtensionsOfInterest .txt -ProjectWiseFolder dww\DocImportTest -ServerIsUtc -Verbose
And the result for one of the text documents:
See if this works for you, and if not, please post your script, some information about your source files/folders, and a screenshot of the results in your datasource, as that would help troubleshoot the problem.
Thanks again for replying. I reran the import a few times and seems you are right. Maybe I was just getting confused with the Update Date that is today. That said the only issue is it applies the GMT offset so in our case +8. All times have an additional 8 hours added. I tried with or without the -ServerIsUtc but did not seem to make any difference.
Get-Help was not clear, however is it possible to specify the offset or correct for it?
I'll try to take a look at the code behind the Cmdlet and see if it is a bug or not. What version of ProjectWise are you using on your client machine (where you are running your script), and the version of ProjectWise hosting the datasource?
It isn't likely, but how datetime is saved for a file varies by file system type (FAT32, EXFAT, NTFS, etc.), so what type of file system is involved?
Keep in mind that the timestamps for files you see in ProjectWise Explorer are from the database, and the precision of that timestamp is limited by the way the database implements that data type, so it rarely matches the timestamp on the file EXACTLY. It is "close enough" for humans, but if you compare them directly, the odds are that they will not always "match", so if you do compare them, use a "delta" value (how close is close enough for your purposes).