DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: SOLVED: Quick PowerShell Question  (Read 8,494 times)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 563
SOLVED: Quick PowerShell Question
« on: October 03, 2018, 06:16 AM »
I'd like to change the date of all files in a folder, recursively.

A PowerShell script I've found on the Internet to do this is:


$files =  Get-ChildItem -force -recurse | Where-Object {! $_.PSIsContainer}
foreach($object in $files)
{
    $object.CreationTime=("10 November 2016 12:00:00")
}


My question is:  Where would one place the folder to be acted upon?

The script above operates on the 'current' folder.  But I'd like to act upon a different folder from 'current.'

Example: C:\Files\*.*

If anyone knows of another 'command line' (i.e., batch file) way of doing the job, please share.

Thanks!

Nicholas Kormanik

highend01

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 188
Re: SOLVED: Quick PowerShell Question
« Reply #1 on: October 03, 2018, 07:14 AM »
The answer is in the documentation?
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-6

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 563
Re: SOLVED: Quick PowerShell Question
« Reply #2 on: October 03, 2018, 07:53 AM »
Good link, highend01.  Explains what I need to know.

Skwire, mark this thread as closed.

Original address: https://www.donationcoder.com/forum/index.php?topic=46478.0