vb 文件夹内文件计数_按文件类型计数和总大小

vb 文件夹内文件计数

Article Update 13-March-2020: I removed the full source code and the code snippets. The article that remains should act as a "design roadmap" for members who want to write the code in the programming language of your choice. If you are interested in discussing the program further, please contact me via the EE message system. 文章更新2020年3月13日:我删除了完整的源代码和代码片段。 对于希望用您选择的编程语言编写代码的成员,剩下的文章应作为“设计路线图”。 如果您有兴趣进一步讨论该程序,请通过EE消息系统与我联系。 INTRODUCTION 介绍

This article was inspired by a recent question here at Experts Exchange. In response to that, I wrote a "quick-and-dirty" script that performs the function requested by the Original Poster, but it has numerous shortcomings. This article describes a major revision of that script, which addresses the shortcomings in the original one.

本文的灵感来自于Experts Exchange上一个最近的问题 。 对此,我编写了一个“快速且肮脏”的脚本,该脚本执行了原始海报所要求的功能,但是它有许多缺点。 本文介绍了该脚本的主要修订版,该修订版解决了原始脚本中的缺点。

PROBLEM DESCRIPTION 问题描述

The objective is to report a count of the files, for each file type (file extension), in a folder and all of its subfolders. In addition, the report should contain the total size of all files for each file type. Example:

目的是报告文件夹及其所有子文件夹中每种文件类型(文件扩展名)的文件计数。 此外,报告应包含每种文件类型的所有文件的总大小。 例:

SOLUTION

I wrote the original "quick-and-dirty" script in AutoHotkey, an excellent (free!) programming/scripting language. The quick explanation for installing AutoHotkey is to visit its website. A more comprehensive explanation is to read my EE article, AutoHotkey - Getting Started. After installation, AutoHotkey will own the AHK file type, supporting the solution discussed in the remainder of this article.

我用AutoHotkey (一种出色的(免费!)编程/脚本语言)编写了原始的“快速处理”脚本。 安装AutoHotkey的快速说明是访问其网站 。 更全面的解释是阅读我的EE文章AutoHotkey-Getting Started 。 安装后,AutoHotkey将拥有AHK文件类型,支持本文其余部分讨论的解决方案。

The new script improves upon the previous one in the following ways:

新脚本在以下方面对上一个脚本进行了改进:

o  The original script hard-codes the name of the source folder. The new script provides a standard Windows "Browse for Folder" dialog that allows the user to navigate to the folder (or type or copy/paste the folder name). o原始脚本对源文件夹的名称进行硬编码。 新脚本提供了标准的Windows“浏览文件夹”对话框,该对话框允许用户导航到文件夹(或键入或复制/粘贴文件夹名称)。 o  The original script saves the results in the same file, so the results are not preserved across multiple executions, unless the user manually saves the file. The new script saves the results in a file with the date and time of execution (including seconds) in the file name (yyyy-MM-dd_HH.mm.ss), so there are never duplicate or overwritten results files. o原始脚本将结果保存在同一文件中,因此除非用户手动保存文件,否则结果不会在多次执行中保留。 新脚本将结果保存到文件名中,文件名(yyyy-MM-dd_HH.mm.ss)中带有执行日期和时间(包括秒),因此不会重复或覆盖结果文件。 o  The original script saves the results in a simple text file. The n
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值