简体   繁体   English

如何获取 Mac OS 或 Windows 10 文件夹下所有 PDF 文件的字数

[英]How can I getting word count for all PDF Files under a folder in Mac OS or Windows 10

I know some way to getting word count for a single PDF Files, but I have a folder which contains 500+ PDF files so I would like to know if there is a faster way to get the word count for all of them without opening every single file and do the copy past stuff like that.我知道一些方法来获取单个 PDF 文件的字数,但是我有一个文件夹,其中包含 500+ PDF 文件,所以我想知道是否有更快的方法来获取所有文件的字数,而无需打开每个文件文件并复制过去的东西。

I'm using macOS Catalina 10.15.5, If there is a solution for Windows 10 that also fine for me.我正在使用 macOS Catalina 10.15.5,如果有 Windows 10 的解决方案对我来说也很好。

I just launched following command on my Windows machine:我刚刚在我的 Windows 机器上启动了以下命令:

Prompt>dir *.txt /S

There was an enormous output, and at the end, there was:有一个巨大的output,最后是:

     Total Files Listed:
            3620 File(s)     93.074.638 bytes
               0 Dir(s)  410.585.006.080 bytes free

Edit after first comment在第一条评论后编辑
PDF is a format, which is made to be human-readable, not computer-readable, so doing some parsing and making some calculations on it, just using some simple computer commands, I don't believe it is even possible. PDF 是一种格式,它被制成人类可读的,而不是计算机可读的,所以对其进行一些解析和计算,只是使用一些简单的计算机命令,我不相信它是可能的。

You can use pdfgrep which you can install with homebrew using:您可以使用pdfgrep ,您可以使用homebrew安装它:

brew install pdfgrep

Then your command to count the words in all the files will be:然后,您计算所有文件中单词的命令将是:

pdfgrep -c -P  "\b.*\b"  *.pdf

Sample Output样品 Output

Arduino Wireless Communication With the HC-12.pdf:512
sample.pdf:0
simple.pdf:4
text.pdf:22

The -P means to use PCRE , or "Perl Compatible Regular Expressions" wherein \b signifies a word boundary - ie the start or end of a word. -P表示使用PCRE“Perl 兼容正则表达式” ,其中\b表示单词边界 - 即单词的开头或结尾。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Mac OS X和Windows 10之间轻松共享文件 - How to share easily files between Mac OS X and Windows 10 如何在Windows文件夹中的所有文件中使用pandoc? - How can I use pandoc for all files in the folder in Windows? 如何将 chromebook 操作系统更改为 Windows 10 - How can i change chromebook OS to Windows 10 如何将目录及其子目录的所有文件的修改日期更新为当前日期? (Windows 10) - How can I update modified date to current date in all files of a directory and its subdirectories? (Windows 10) 如何使用 windows 10 中的另一个文件夹扩展文件夹,以使两个文件夹中的所有文件都可以从一个路径访问? - How to extend folder with another folder in windows 10, in such way that all files in both folders are accessible from one path? 如何使用Windows cmd命令将所有文件移动到父文件夹 - How can I move all files to the parent folder using windows cmd command 如何在 Mac OS 上运行的 Windows RDP 中使用 Windows 键快捷方式? - How can I use Windows-Key shortcuts inside a Windows RDP running on Mac OS? 如何在Windows 10下自动设置和配置Linux的Windows子系统? - How can I automatically setup and configure the Windows Subsystem for Linux under Windows 10? 如何将我的工作文件夹设置为项目中的根文件夹(Windows 10) - How can I set my working folder as a root folder in my project (Windows 10) 我可以将Windows上的Android Studio项目构建导入到Mac OS吗? - Can i import android studio project build on windows to mac os?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM