windows下powershell中类似find命令的替代

windows下powershell中类似find命令的替代

2023年7月26日发(作者:)

windows下powershell中类似find命令的替代gcr -r -fi 替代bash中的find . -name '*.jar'windows下的powershell中可以使⽤Get-ChildIItem进⾏替换,参数有所不同:-Recurse (简写是-r)递归遍历所有⽬录-Filter (简写-fi) 通过名字进⾏过滤, ⽀持 *, ?匹配,但是不是正则上⾯的find命令,powershell下⾯的对应的表达式是Get-ChildItem -Recurse -Filter '*.jar'简写就是gci -r -fi *.jar正则⽅式需要使⽤正则⽅式的话可以pipe 给Where-Object (简写就是 where)过滤器如gci -r |where Name -match '.jar$'其他的如果想要过滤太⼩的⽂件可以gci -r |where Length -gt 3000想要看⼀个⼩时内访问的⽂件gci -r |where LastAccessTime -gt (Get-Date).AddHours(-1)其他复杂的组合⽅式如gcr -i | where {$_.Length -gt ( 3 * 1024 ) -or $_.LasterWriteTime -gt "04/23/2020" }refers:

发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1690359732a337605.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信