Get-FilewithExtension
1: <#
2: 用途:
3: 根据指定的路径和文件类型查找出文件,显示其完整路径以及大小
4: 使用方法:
5: Get-FilewithExtension -path path1,path2,path3 -extension .bak,.csv -CsvFilePath e:\result.csv
6: #>
7: function Get-FilewithExtension
8: ([array] $Path, #指定要查询的路径
9: [array] $Extension, #指定文件类型
10: [string]$CsvFilePath) #指定导出结果文件
11: {
12: $result = @()
13: $file = Get-ChildItem -Path $Path -Recurse |Where-Object {$_.PSIsContainer -eq $false}
14: foreach($i in $file)
15: {
16:
17: if($Extension.Contains($i.Extension) -eq $true)
18: {
19: $obj = New-Object -TypeName PSObject
20: $obj | Add-Member NoteProperty 文件路径 $i.FullName
21: $obj | Add-Member NoteProperty 文件大小 $i.Length
22: $result +=$obj
23: }
24:
25: }
26: $result |Export-Csv $CsvFilePath -Encoding OEM -NoTypeInformation
27: }
随机推荐
- centos7.0 下安装git(ssh方式)
最近刚弄了个阿里云,在上面弄个git服务器,这里只弄了ssh方式访问,http方式访问的可以看我另外一个随笔http://www.cnblogs.com/hz-cww/p/6077970.html. ...
- 动态创建DAL层类的实例
为了可扩展性,方便以后对于代码的修改维护,使用动态创建DAL层对象. 1.首先在webconfig中的configuration下添加配置项 <appSettings> <add k ...
- C# Cookie
1 推荐使用 is 或 as 操作符而不是强制 2 编码风格:Tab ——改成两个 C# 文档注释的快捷键 (将配置表压缩,从压缩文件中查找xml配置表 这个是指Unity项目上面) 尽量使 ...
- 【leetcode】Palindrome Number
题目简述: Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could n ...
- Python-基础数据类型
数据类型 计算机顾名思义就是可以做数学计算的机器,因此,计算机程序理所当然地可以处理各种数值.但是,计算机能处理的远不止数值,还可以处理文本.图形.音频.视频.网页等各种各样的数据,不同的数据,需要定 ...
- JsonHelper MergeJsonTemplate
namespace Test { using Newtonsoft.Json; using System; using System.Collections.Generic; using System ...
- Mybatis拦截器
Mybatis拦截器
- 微服务中的netty
一般使用netty主要是整个netty流程的理解,实际开发中服务端.客户端参数的配置,以及连接 handle的管理是关键,再有就是encode和decode编码.解码. 服务端流程图 客户端流程图包含 ...
- OGNL的使用
访问Action中的普通属性: <s:property value="loginname"/><br/> 访问Action中的对象属性: <s:pro ...
- 使用CocoaPods过程中 Unable to find a specification for
文章转自:http://blog.csdn.net/zhangao0086/article/details/39703083 当把CocoaPods生成的workspace移动到上层目录时,需要改下P ...