Welcome › Forums › General PowerShell Q&A › Copy-item cmdlet copies folder with latest timestamp
Hi All,
I’m new to this forum & powershell, Question may sound silly
I’m writing script to copy folder to remote servers, I tried with copy-item cmdlet and I see folder are copied but with latest timestamp
i do not want the timestamp to be changed
Thank you
There are 3 timestamps with files: Created, Modified and Accessed. Windows updates Created and Accessed when you copy a file this is not really a PowerShell issue but PowerShell can “fix” it.
This brings up another point which is you shouldn’t really rely on these timestamps because they are very easily modified.
Or you can use robocopy with /DCOPY:T
An example:
robocopy \\server\share\path \\server\share\path *.* /E /R:1 /W:1 /XJ /COPY:DAT /DCOPY:T /NP /LOG:C:\temp\robo.log /TEE
There are many switches to robocopy … these are in my opinion the basics.