PowerShell: Touch files

That is, in the unix sense of the term – updating files with a Now-type timestamp. Take this group of files with different datetime stamps:

touchFile01

In fact the dates don’t differ as much as I would have liked, but no matter. Let’s say we want to get to this:

touchFile02

This is a command to get there:

(gci C:\Perl) | ForEach-Object {$_.LastWriteTime = Get-Date}

, as you see here:

touchFile03

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s