Last active
          January 21, 2021 00:17 
        
      - 
      
- 
        Save efann/44f782811c9c93df85034d713f258447 to your computer and use it in GitHub Desktop. 
    Emulates Linux touch for Windows
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | [CmdletBinding()] | |
| param( | |
| [Parameter(position=0, Mandatory=$true)] | |
| [String]$lcFolder | |
| ) | |
| $lcDate = Get-date -Format MM/dd/yyyy" "HH:mm:ss | |
| echo "Setting timestamp for $lcFolder" | |
| $loFiles = Get-ChildItem -recurse "$lcFolder" | |
| foreach($loFile in $loFiles) | |
| { | |
| $loFile.CreationTime=($lcDate) | |
| $loFile.LastAccessTime=($lcDate) | |
| $loFile.LastWritetime=($lcDate) | |
| } | |
| echo "Timestamps set for $lcFolder using $lcDate" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment