比较目标文件夹和子文件夹中特定文件类型的计数和组合文件大小 [英] Comparing count and combined file sizes of specific file types in target folder and subfolders

查看:98
本文介绍了比较目标文件夹和子文件夹中特定文件类型的计数和组合文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个脚本用于删除文件夹及其子文件夹中具有特定文件扩展名的文件。我想通过计算脚本正在删除的文件总数及其组合大小(MB)来增强脚本,并在弹出窗口中使用此信息
,其中消息将显示"X No. Files"之类的内容删除总计YMB



到目前为止的现有脚本是:

get-childitem  -include *。****。rfa - 递归| foreach($ _){remove-item $ _。fullname}

可以告诉我需要添加什么,因为我对powershell很新。

谢谢

Hi all,

I have a script that I use to delete files with a certain file extension in a folder and its subfolders. I would like to enhance to the script by counting the total number of files and their combined size in MB that the script is deleting and use this information in a popup where a message will say something like "X No. Files deleted totalling YMB

The existing script so far is:
get-childitem  -include *.****.rfa -recurse | foreach ($_) {remove-item $_.fullname}
Can any advise what I need to add as I'm quite new to powershell.
Thanks

推荐答案

首先我们修复你的代码:

First we fix your code:


files = get-childitem -include * .rfa -recurse
files=get-childitem -include *.rfa -recurse


size =(


这篇关于比较目标文件夹和子文件夹中特定文件类型的计数和组合文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆