Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Using PowerShell
>
General PowerShell
Clearing file dates/times
Last Post 22 Jul 2010 11:42 PM by
absolutebeginner
. 4 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
absolutebeginner
New Member
Posts:14
22 Jul 2010 08:59 AM
Hello, how can I get PS to delete/clear the LastWriteTime and LastAccessTime of files, so that only the CreationTime remains? Thanks a lot.
PoSherLife
Basic Member
Posts:364
22 Jul 2010 09:39 AM
you can use the CreationTime property to with set_LastWriteTime and set_LastAccessTime you can reset the LastWriteTime and LastAccessTime.
gci c:\temp | % {$_.set_LastWriteTime($_.CreationTime);$_.set_LastAccessTime($_.CreationTime)}
I can't find any ways to remove completely the properties your looking for.
When at first you don't succeed
Step-Into
http://theposherlife.blogspot.com
http://www.jandctravels.com
absolutebeginner
New Member
Posts:14
22 Jul 2010 11:55 AM
Thanks. That's just as good.
One problem: If I try that on folders I get an error message that the process can't access the folders as they are in use. Do you know how I can circumvent that?
PoSherLife
Basic Member
Posts:364
22 Jul 2010 01:10 PM
gci c:\temp | ? { $_.PSIsContainer -ne $true } | % {$_.set_LastWriteTime($_.CreationTime);$_.set_LastAccessTime($_.CreationTime)}
When at first you don't succeed
Step-Into
http://theposherlife.blogspot.com
http://www.jandctravels.com
absolutebeginner
New Member
Posts:14
22 Jul 2010 11:42 PM
Thanks.
You are not authorized to post a reply.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Using PowerShell
>
General PowerShell
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2