Powershell 没有设置准确的修改时间?
Powershell not setting exact modified time?
所以我真的不介意,也不是特别重要,但我写了一个 powershell 脚本来设置编解码器转换的家庭电影的时间。原始文件分机名为 MP44,生成的文件分机为 MP4。我只是想明白为什么时间不完全一样
Directory of C:\Users\zzz\Desktop\family videos and images\hero 2021
2022-03-18 05:24 PM <DIR> .
2022-03-16 07:18 AM <DIR> ..
2020-09-02 07:15 PM 79,353,358 ffmpeg.exe
2020-09-02 07:15 PM 79,214,606 ffplay.exe
2020-09-02 07:15 PM 79,249,422 ffprobe.exe
2022-03-16 09:45 PM 482 go.bat
2021-12-24 09:14 PM 4,000,895,516 GX010066.MP44
2021-12-24 09:14 PM 741,345,212 GX010066.MP44.ffmpeg.mp4
2021-12-24 10:25 PM 4,003,210,355 GX010067.MP44
2021-12-24 10:25 PM 687,471,776 GX010067.MP44.ffmpeg.mp4
2021-12-24 09:15 PM 4,001,034,065 GX020066.MP44
2021-12-24 09:15 PM 719,404,024 GX020066.MP44.ffmpeg.mp4
2021-12-24 10:27 PM 3,629,297,689 GX020067.MP44
2021-12-24 10:27 PM 635,027,797 GX020067.MP44.ffmpeg.mp4
2021-12-24 09:17 PM 4,000,513,626 GX030066.MP44
2021-12-24 09:17 PM 690,608,291 GX030066.MP44.ffmpeg.mp4
2021-12-24 09:17 PM 714,946,960 GX040066.MP44
2021-12-24 09:17 PM 125,647,486 GX040066.MP44.ffmpeg.mp4
2022-03-18 05:36 PM 537 timechanger.ps1
17 File(s) 24,187,221,202 bytes
2 Dir(s)
Directory shows same times/dates.
I guess it's more of a windows question than a powershell question. Why would explorer show different modified dates?
Here is my powershell for posterity:
$files = Get-ChildItem *.mp44 | select Name, LastWritetime
foreach ($file in $files) {
$currentname = $file.name
#$currentname
$currentsubstring = $currentname.substring(0,8)
#$currentsubstring
$WriteTime = $file.LastWritetime
#$WriteTime
write-host "Going to get-item $currentsubstring.MP44.ffmpeg.mp4 and set $Writetime"
$targetfile = "$currentsubstring.MP44.ffmpeg.mp4"
$Targettime = $Writetime
$bacon = Get-Item $targetfile
$bacon.LastWritetime = $targettime
}
提前感谢您的时间和帮助。
因为您显示的 Windows 资源管理器中的 'Date' 列是创建日期 属性,而不是上次修改日期。
请注意“日期”列如何匹配“创建日期”列,而不是我屏幕截图中的“修改日期”列。
所以我真的不介意,也不是特别重要,但我写了一个 powershell 脚本来设置编解码器转换的家庭电影的时间。原始文件分机名为 MP44,生成的文件分机为 MP4。我只是想明白为什么时间不完全一样
Directory of C:\Users\zzz\Desktop\family videos and images\hero 2021
2022-03-18 05:24 PM <DIR> .
2022-03-16 07:18 AM <DIR> ..
2020-09-02 07:15 PM 79,353,358 ffmpeg.exe
2020-09-02 07:15 PM 79,214,606 ffplay.exe
2020-09-02 07:15 PM 79,249,422 ffprobe.exe
2022-03-16 09:45 PM 482 go.bat
2021-12-24 09:14 PM 4,000,895,516 GX010066.MP44
2021-12-24 09:14 PM 741,345,212 GX010066.MP44.ffmpeg.mp4
2021-12-24 10:25 PM 4,003,210,355 GX010067.MP44
2021-12-24 10:25 PM 687,471,776 GX010067.MP44.ffmpeg.mp4
2021-12-24 09:15 PM 4,001,034,065 GX020066.MP44
2021-12-24 09:15 PM 719,404,024 GX020066.MP44.ffmpeg.mp4
2021-12-24 10:27 PM 3,629,297,689 GX020067.MP44
2021-12-24 10:27 PM 635,027,797 GX020067.MP44.ffmpeg.mp4
2021-12-24 09:17 PM 4,000,513,626 GX030066.MP44
2021-12-24 09:17 PM 690,608,291 GX030066.MP44.ffmpeg.mp4
2021-12-24 09:17 PM 714,946,960 GX040066.MP44
2021-12-24 09:17 PM 125,647,486 GX040066.MP44.ffmpeg.mp4
2022-03-18 05:36 PM 537 timechanger.ps1
17 File(s) 24,187,221,202 bytes
2 Dir(s)
Directory shows same times/dates.
I guess it's more of a windows question than a powershell question. Why would explorer show different modified dates?
Here is my powershell for posterity:
$files = Get-ChildItem *.mp44 | select Name, LastWritetime
foreach ($file in $files) {
$currentname = $file.name
#$currentname
$currentsubstring = $currentname.substring(0,8)
#$currentsubstring
$WriteTime = $file.LastWritetime
#$WriteTime
write-host "Going to get-item $currentsubstring.MP44.ffmpeg.mp4 and set $Writetime"
$targetfile = "$currentsubstring.MP44.ffmpeg.mp4"
$Targettime = $Writetime
$bacon = Get-Item $targetfile
$bacon.LastWritetime = $targettime
}
提前感谢您的时间和帮助。
因为您显示的 Windows 资源管理器中的 'Date' 列是创建日期 属性,而不是上次修改日期。
请注意“日期”列如何匹配“创建日期”列,而不是我屏幕截图中的“修改日期”列。