import os
import tarfile
from datetime import datetime

def create_tar_without_spaces(src_dir, tar_path):
    # 디렉토리가 없으면 생성
    os.makedirs(os.path.dirname(tar_path), exist_ok=True)

    files_to_add = []

    for root, _, files in os.walk(src_dir):
        for file in files:
            if ' ' in file:
                continue  # 공백 포함된 파일 제외
            full_path = os.path.join(root, file)
            rel_path = os.path.relpath(full_path, src_dir)
            files_to_add.append((full_path, rel_path))

    with tarfile.open(tar_path, "w") as tar:
        for full_path, rel_path in files_to_add:
            tar.add(full_path, arcname=rel_path)

    print(f"✅ Created tar file: {tar_path} with {len(files_to_add)} files (공백 제외)")

if __name__ == "__main__":
    timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
    src_directory = "D:\\src\\src\\main"
    output_tar = f"D:\\tmp\\src-backup\\backup-{timestamp}.tar"
    create_tar_without_spaces(src_directory, output_tar)


# .*? -- non greedy
'2025.*?'


mysql mingw

카테고리 없음 2025. 4. 24. 09:58

/c/Program Files/MySQL/MySQL Server 8.0/bin
$ ./mysql.exe -uroot -p1234 kunnodae < /e/big.sql


C:\Users\{user}\AppData\Roaming\DBeaverData\workspace6\.metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi 

삭제




from PyPDF2 import PdfReader, PdfWriter

target_file = "part-과정관리.pdf"

# 원본 PDF 파일 열기
reader = PdfReader("total.pdf")

# 새 PDF 작성을 위한 객체 생성
writer = PdfWriter()

# 인덱스는 0부터 시작
for page_num in range(81, 89):
    writer.add_page(reader.pages[page_num])

# 결과를 새로운 PDF로 저장
with open(target_file, "wb") as output_file:
    writer.write(output_file)

print(f"{target_file} 파일이 생성되었습니다.")


$ /c/Program\ Files/LibreOffice/program/soffice.exe --headless --convert-to pdf *.pptx


$ cat 1.txt
aa
bb

sed -i "s/^/'/; s/$/',/" 1.txt

$ cat 1.txt
'aa',
'bb',


from pptx import Presentation
import glob
f = open("ppt.txt", 'w', encoding='utf-8')

for eachfile in glob.glob("*.pptx"):
    prs = Presentation(eachfile)
    print(eachfile)
    print("----------------------")
    for slide in prs.slides:
        for shape in slide.shapes:
            if hasattr(shape, "text"):
                print(shape.text)
                f.write(shape.text)


f.close()