gpt4 book ai didi

powershell - 如何获取目录中 LastWriteTime 最旧的文件?

转载 作者:行者123 更新时间:2023-12-02 22:56:42 25 4
gpt4 key购买 nike

如果我有一个带有通配符的完整路径,我怎样才能获得具有最早 LastWriteTime 的文件?

$fullpath = "myFolder:\foooBar*.txt"
$theOldestFile = # What to write to get among the
#fooBar*.txt that has the max LastWriteTime?

最佳答案

像这样:

$fullpath = "myFolder:\foooBar*.txt"
$theOldestFile = dir $fullpath | sort lastwritetime | select -First 1

关于powershell - 如何获取目录中 LastWriteTime 最旧的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16666047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com