On Thu, 26 Nov 2020 11:18:27 +0000, Terry Pinnell
<m...@somewhere.invalid> wrote:
>Is it possible to achieve the following with either a batch file or
>command prompt on my Win 10 PC please? Or indeed any other hack, such as
>a VBS script, etc?
Is PowerShell allowed?
>Somehow the Date Modified entries for all the
>subfolders containing the INO files have lost their original dates.
That is a feature. Take a look at this link for a possible explanation
and a generic solution:
https://ss64.com/ps/syntax-lastmodified.html
>I want to automatically change all the subfolder Date Modified entries
>to equal the Date Modified entry of its INO file of the same name.
The following solution will process the INO file's parent folder
regardless of its name. Might be close enough?
The Windows File Explorer tends to keep folders open, in which case
the date cannot be set. Close all Explorer windows before you run the
script.
The script is wrapped so that it can be saved as a BAT file, which
makes it on-topic for this group. If you want, you can remove the
first line and save it as a PS1 file to make a normal PowerShell
script. The script lines are double spaced, so you can easily spot
line wraps. Edit the path to your preference, of course.
findstr /V "SomeRandomVeryUnlikelyText" %0|powershell -command -&goto
:EOF
$arduinoPath = "F:\test\arduino"
$fileList = Get-ChildItem -Path $arduinoPath -Filter "*.ino" -File
-Recurse
ForEach ($file in $fileList) {$file.Directory.LastWriteTime =
$file.LastWriteTime}
--
RoRo