简体   繁体   English

对文件夹中的所有文件递归运行终端命令

[英]Run a terminal command recursively for all files in a folder

I am working on a problem that requires me to extract text from a pdf. 我正在解决一个需要从pdf提取文本的问题。 I am using pdfbox in order to do so. 我正在使用pdfbox来这样做。 So, I run this command in the terminal (linux ubuntu): 因此,我在终端(linux ubuntu)中运行以下命令:

java -jar pdfbox-app-1.8.7.jar ExtractText [path leading to file here]

and everything works. 一切正常。 However, I want to do this recursively for thousands of files in a particular directory, so I don't have to manually plug in the pdf path every time. 但是,我想对特定目录中的数千个文件进行递归操作,因此不必每次都手动插入pdf路径。 I would appreciate any solution that's either from the terminal or a script. 我会很感激任何来自终端或脚本的解决方案。

使用find命令:

find /path/to/directory -type f -exec java -jar pdfbox-app-1.8.7.jar ExtractText {} \;

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

相关问题 如何在pycharm中递归运行文件夹中的所有doctests? - How to run all doctests in a folder recursively in pycharm? 递归解析所有xml文件并排除文件夹 - Recursively parse all xml files and exclude folder Python脚本,用于对文件夹中的所有文件运行命令 - Python Script to run a command over all files in a folder SFTP:从远程服务器递归复制/下载文件夹中的所有文件 - SFTP: Copy/Download all files in a folder recursively from remote server 在 Python 中递归生成文件夹中所有文件的绝对路径的最快方法? - Fastest way to generate the absolute paths of all the files in a folder recursively in Python? 如何递归地将子目录中的所有文件移动到主文件夹? [Python] - How to recursively move all files inside subdirectories to main folder? [python] 使用 Python 递归地从共享文件夹中获取所有文件 - Recursively fetch all files from shared folder using Python Python脚本以递归方式重命名文件夹和子文件夹中的所有文件 - Python script recursively rename all files in folder and subfolders 使用glob在三个子文件夹中递归查找所有zip个文件 - Using glob to find all zip files recursively in three sub folder 如何为文件夹/目录中的所有文件运行脚本 - How to run script for all files in a folder/directry
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM