Initial commit
This commit is contained in:
24
Dokumentace_uprava_jmena_souboru.py
Normal file
24
Dokumentace_uprava_jmena_souboru.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import os,re
|
||||
|
||||
def set_single_page_view (filepdfin):
|
||||
from pikepdf import Pdf, Dictionary, Name
|
||||
import os
|
||||
from pathlib import Path
|
||||
pdf=Pdf.open(filepdfin,allow_overwriting_input=True)
|
||||
# file_only_path=os.path.dirname(filepdfin)
|
||||
# file_without_ext = Path(filepdfin).stem
|
||||
pdf.Root.PageLayout=Name('/SinglePage')
|
||||
pdf.Root.PageMode=Name('/UseNone')
|
||||
pdf.save()
|
||||
|
||||
|
||||
cesta=r"u:\NextCloudOrdinace\Dokumentace"
|
||||
|
||||
for file in os.listdir(cesta):
|
||||
if file.upper().endswith((".PDF")) and os.path.isfile(os.path.join(cesta,file)):
|
||||
nalezeno=re.search('(\d{9,10} \S*)( )(.*)',file)
|
||||
if nalezeno:
|
||||
print(nalezeno.group(1),nalezeno.group(2),nalezeno.group(3))
|
||||
newfilename=nalezeno.group(1)+", "+nalezeno.group(3)
|
||||
print(newfilename)
|
||||
os.rename(os.path.join(cesta,file),os.path.join(cesta,newfilename))
|
||||
Reference in New Issue
Block a user