Linux下批量把PDF檔案轉換為txt文本的小程式__JSON

來源:互聯網
上載者:User

原文:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=251071&start=0

 

本程式的核心部分是調用了Linux 下的pdftotxt命令。

 

 

#!/bin/bash #與朋友們共用。如果大家有好的修改意見,歡迎給我留言。ubuntu.org.cn centerpoint 感謝irc#ubuntu-cn iGoogle等大牛的協助。歡迎留言指正。 #功能:本程式可以把pdf檔案批量轉換成txt文本。 #用法:maxdepth 跟的數是目錄深度,1為本目錄。把本檔案儲存為pdf2txt.sh,把許可權設為“可執行”,然後複製到要轉換的pdf檔案目錄。在命令列下cd到那個目錄。 #執行 ./pdf2txt.sh 即可。 #作者:ubuntu.org.cn centerpoint 2010.1.6 #掃描的檔案類型。 find ./ -maxdepth 1 -name '*.pdf'>files.mybak myi=0 while read line do filename="${line##*/}"; myi=`echo "$myi+1"|bc` echo "************************$myi***************************" ls -sh "${filename}" pdftotext "${filename}" ls -sh "${filename%%.pdf}.txt" done < files.mybak rm files.mybak 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.