Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Retaining modified date on files being unzipped using PowerShell

$
0
0

Hello all:

I am writing a script that will unzip a file located on a networked share and place the files on my local machine.  The problem I am having is when the script copies the files over, the files have a modified date of today's date.  How can I copy the files locally while maintaining the modified date on the files?  This is an important requirement for version control.  The snippet I am referring to in my script follows:

$shell = new-object -com shell.application
$zip = $shell.NameSpace("\\server\zippedFile.zip")
foreach($item in $zip.items())
{
$shell.Namespace("E:\Unzipped Files").CopyHere($item, 0x14)
}

I have WinRar installed so if there is a better way using that, please advise.

Thanks,

jocasio


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>