2019年12月18日 星期三

批次轉檔程式Docto / PDF轉檔 以及 大量關鍵字檔案拷貝

@echo off

:start

if exist "C:\Temp\Word\*.docx" (
for %%x in (C:\Temp\Word\*.docx) do "C:\Program Files\Microsoft Office\Office16\WINWORD.EXE" "%%x" /q /n /mFilePrintDefault /mFileExit /mFileCloseOrExit
)

Del C:\temp\Word\*.docx

timeout /t 90
goto start

Docto (批此轉檔程式)
  1. Convert Doc/RTF/Text file to any Word SaveAs Type Doc/Text/RTF/PDF
  2. Convert XLS/XLSX/CSV file to any Excel SaveAs Type CSV/Text/PDF
  3. Convert Text/CSV file to full fledged Word or Excel format.
https://github.com/chuckchou/DocTo

下載回來 新建批次檔  
以下是每90秒檢查C:\Word 資料夾 如果有檔案就轉檔成PDF至C:\PDF資料夾

@echo off

:start

"C:\docto\docto.exe" -WD -f "C:\Word" -o "C:\PDF" -t wdFormatPDF

Del C:\Word\*.docx

timeout /t 90
goto start

輸入keyword 在SNlist 裡面 可以在特地路徑(Z槽)裡搜尋 並且把檔案拷貝出來
-----------------------------------------------------------------------------------------------------------------------
import os, shutil from os import walk SNlist = [''] rootdir = 'z:\\' for root, dirpath , filenames in walk(rootdir): for filename in filenames: for list in SNlist: if list in filename: #print ("the full path of the file is:" + os.path.abspath(os.path.join(root, filename))) # 輸出檔案路徑資訊 shutil.copy(os.path.abspath(os.path.join(root, filename)), 'C:\\temp\\report')

沒有留言:

張貼留言