ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

SOLVED: Quick PowerShell Question

(1/1)

nkormanik:
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:
The answer is in the documentation?
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-6

nkormanik:
Good link, highend01.  Explains what I need to know.

Skwire, mark this thread as closed.

Navigation

[0] Message Index

Go to full version