Windows command line utility that will increase the date modified/created of a file to "current time + 1 day"?

I have used utilities like touch.exe and FileTouch.exe that can set a file's date modified/created to the current system time.  But what I want is to set a file's date modified/created to one day later than the current system time.  Could anyone write a batch file that would do this, using touch.exe or whatever?  Or any other way, like PowerShell?

Thanks.
meirionwylltSenior Desktop EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
As a one-liner in Powershell:
$Item = Get-Item "C:\Temp\touch.txt"; $TouchDate = (Get-Date).AddDays(1); "CreationTime", "LastWriteTime" | % {$Item.$_ = $TouchDate}

Open in new window

This could of course be turned into a function with parameters; how flexible do you need to be in terms of the new date?
meirionwylltSenior Desktop EngineerAuthor Commented:
Great stuff - that works!

Can I just modify this silghtly to put it in my real-world situation?

There *.ade files in \\domain.local\adnoddau\cgsd\Cronfeydd Data\Newydd

I want the script to do the "+1 day" as above for all *.ade files in that folder, and then move all these *.ade files into this folder \\domain.local\adnoddau\cgsd\Cronfeydd Data, overwriting what's already there.

Could you incorporate this as well?

Many thanks.
oBdACommented:
This should do the trick; short version for copy and paste into a PS console:
$Source = "\\domain.local\adnoddau\cgsd\Cronfeydd Data\Newydd\*.ade"
$Target = "\\domain.local\adnoddau\cgsd\Cronfeydd Data"
$TouchDate = (Get-Date).AddDays(1)
Get-ChildItem -Path $Source -File | % {"Touching and moving $($_.Name) ..." | Write-Host; $_.CreationTime = $TouchDate; $_.LastWriteTime = $TouchDate; Move-Item -Path $_.FullName -Destination $Target -Force -ErrorAction Continue}

Open in new window

Expanded version:
$Source = "\\domain.local\adnoddau\cgsd\Cronfeydd Data\Newydd\*.ade"
$Target = "\\domain.local\adnoddau\cgsd\Cronfeydd Data"
$TouchDate = (Get-Date).AddDays(1)
Get-ChildItem -Path $Source -File |
	ForEach-Object {
		"Touching and moving $($_.Name) ..." | Write-Host
		$_.CreationTime = $TouchDate
		$_.LastWriteTime = $TouchDate
		Move-Item -Path $_.FullName -Destination $Target -Force -ErrorAction Continue
	}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
meirionwylltSenior Desktop EngineerAuthor Commented:
Excellent work - thank you!  Points well deserved.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.