Skip to main content
replaced http://superuser.com/ with https://superuser.com/
Source Link

I have found the following question on ServerFault:

Windows recursive touch commandWindows recursive touch command

Which partially answers my question with this answer:

Windows recursive touch commandWindows recursive touch command

However, I would like to touch all files (in root and sub folders (recursively)) that are newer than 31st January 2013 (31/01/13). How would I go about doing this?

I have PowerShell 2 available.

UPDATE:

I have found that this scriptlet gets all of the files that I am after:

Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }

But I am not sure how to combine it with the "touch" command:

(ls file).LastWriteTime = DateTime.now

The following seems logical but I cannot test it as backing up my files will screw up my files' modified date/times:

(Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }).LastWriteTime = DateTime.now

So, will this work?

I have found the following question on ServerFault:

Windows recursive touch command

Which partially answers my question with this answer:

Windows recursive touch command

However, I would like to touch all files (in root and sub folders (recursively)) that are newer than 31st January 2013 (31/01/13). How would I go about doing this?

I have PowerShell 2 available.

UPDATE:

I have found that this scriptlet gets all of the files that I am after:

Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }

But I am not sure how to combine it with the "touch" command:

(ls file).LastWriteTime = DateTime.now

The following seems logical but I cannot test it as backing up my files will screw up my files' modified date/times:

(Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }).LastWriteTime = DateTime.now

So, will this work?

I have found the following question on ServerFault:

Windows recursive touch command

Which partially answers my question with this answer:

Windows recursive touch command

However, I would like to touch all files (in root and sub folders (recursively)) that are newer than 31st January 2013 (31/01/13). How would I go about doing this?

I have PowerShell 2 available.

UPDATE:

I have found that this scriptlet gets all of the files that I am after:

Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }

But I am not sure how to combine it with the "touch" command:

(ls file).LastWriteTime = DateTime.now

The following seems logical but I cannot test it as backing up my files will screw up my files' modified date/times:

(Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }).LastWriteTime = DateTime.now

So, will this work?

Added my own trial solution for opinions
Source Link

I have found the following question on ServerFault:

Windows recursive touch command

Which partially answers my question with this answer:

Windows recursive touch command

However, I would like to touch all files (in root and sub folders (recursively)) that are newer than 31st January 2013 (31/01/13). How would I go about doing this?

I have PowerShell 2 available.

UPDATE:

I have found that this scriptlet gets all of the files that I am after:

Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }

But I am not sure how to combine it with the "touch" command:

(ls file).LastWriteTime = DateTime.now

The following seems logical but I cannot test it as backing up my files will screw up my files' modified date/times:

(Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }).LastWriteTime = DateTime.now

So, will this work?

I have found the following question on ServerFault:

Windows recursive touch command

Which partially answers my question with this answer:

Windows recursive touch command

However, I would like to touch all files (in root and sub folders (recursively)) that are newer than 31st January 2013 (31/01/13). How would I go about doing this?

I have PowerShell 2 available.

I have found the following question on ServerFault:

Windows recursive touch command

Which partially answers my question with this answer:

Windows recursive touch command

However, I would like to touch all files (in root and sub folders (recursively)) that are newer than 31st January 2013 (31/01/13). How would I go about doing this?

I have PowerShell 2 available.

UPDATE:

I have found that this scriptlet gets all of the files that I am after:

Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }

But I am not sure how to combine it with the "touch" command:

(ls file).LastWriteTime = DateTime.now

The following seems logical but I cannot test it as backing up my files will screw up my files' modified date/times:

(Get-ChildItem C:\path\to\files -recurse | Where-Object { $_.LastWriteTime -ge [DateTime] "1/31/2013 9:00AM" }).LastWriteTime = DateTime.now

So, will this work?

Source Link

PowerShell touch all files newer than

I have found the following question on ServerFault:

Windows recursive touch command

Which partially answers my question with this answer:

Windows recursive touch command

However, I would like to touch all files (in root and sub folders (recursively)) that are newer than 31st January 2013 (31/01/13). How would I go about doing this?

I have PowerShell 2 available.