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:  }

随机推荐

  1. OC推箱子

    #include<stdio.h> #include<stdlib.h> int main(void) { char sr;//存储用户输入的指令 //绘制地图 char a[ ...

  2. CSS--实现小三角形

    <style> html, body { margin: 0; padding: 0; } /*下面用CSS3分别实现向上.下.左.右的三角形*/ .btn-color{ color: # ...

  3. 关于python中的字符串编码理解

    python2.x 中中间编码为unicode,一个字符串需要decode为unicode,再encode为其它编码格式(gbk.utf8等) 以gbk转utf8为例: s = "我是字符串 ...

  4. Git版本控制管理学习笔记5-提交

        这个标题其实有些让人费解,因为会想这个提交是动词还是名称?     提交动作是通过git commit命令来实现的,提交之后会在对象库中新增一个提交对象.提交过程中会发生哪些变化,在上一篇笔记 ...

  5. 【leetcode】Remove Nth Node From End of List

    题目简述: Given a linked list, remove the nth node from the end of list and return its head. For example ...

  6. xamarin(3.9.236)里DATETIMENOW的错误。

    [ERROR] FATAL UNHANDLED EXCEPTION: System.EntryPointNotFoundException: monodroid_get_system_property ...

  7. Global Translator

    Global Translator插件可以把已经通过翻译服务翻译好的内容生成对应语种的“静态”页面,或者说“缓存”起来,这样在一段时间内(可设置)想访问该语种的这 个页面的访客,就可以在不调用翻译服务 ...

  8. 微信小程序简介

    什么是微信小程序? 今年下半年的时候,微信推出了微信小程序,当然刚刚推出来的时候还是处于内测阶段,但是这并不影响这家伙的热度,也许这是一个新的时代的开启.但是什么是微信小程序呢?微信应用号是一个app ...

  9. gulp之压缩合并MD5清空替换加前缀以及自动编译自动刷新浏览器大全

    gulp是基于流的前端构件化工具.目前比较火的前端构建化工具还是挺多的,grunt gulp fis3等等. 这个鬼东西有什么用?请参考https://www.zhihu.com/question/3 ...

  10. Codeforces Round #344 (Div. 2) A. Interview

    //http://codeforces.com/contest/631/problem/Apackage codeforces344; import java.io.BufferedReader; i ...