powershell或其他脚本使文件创建日期=修改日期

发布于 2024-10-09 08:29:51 字数 324 浏览 0 评论 0原文

有些东西弄乱了我的 mp3 和图像库。现在,文件具有正确的修改数据,但创建日期较新

由于某种原因,这使得使用 robocopy 来备份我的库变得不可能(robocopy 认为文件总是在变化,即使它们没有变化)。

我看到人们编写了一些工具来让你通过 gui 甚至 cmd 行编辑文件的属性,但都希望你告诉他们你想要设置的日期。这是行不通的,因为我有 10 年不同日期的文件。

我认为这是一个简单的 powershall 脚本,用于迭代文件夹/子文件夹并将每个文件的创建日期设置为修改日期。

有哪位魔法师可以给我指路吗?或者至少让我开始?

something messed up my mp3 and image library. Now, the files have correct modified data but the creation date is newer!

That for some reason makes using robocopy to backup my library impossible (robocopy thinks files are always changing, even when they did not).

I saw some tools people wrote to let you edit via gui or even cmd line the properties of files, but all expect you to tell them the date you want to set. that will not work since I have files in different dates cross 10 years.

i figured it is a simple powershall script to iterate over folder/sub folder and set each files creation date to be the modified date.

Any poweshall wizard that can show me the way? or at least get me started?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄荷梦 2024-10-16 08:29:51
Get-ChildItem -recurse -filter *.mp3 | % { $_.CreationTime = $_.LastWriteTime }

那应该可以完成工作。

Get-ChildItem -recurse -filter *.mp3 | % { $_.CreationTime = $_.LastWriteTime }

That should do the job.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文