Skip to main content

Encrypt PDF and Excel files in bulk using a password

Project description

File Protector

A Python script for batch encrypting PDF and Excel files while maintaining folder structure.

Features

  • Encrypts PDF and Excel (.xlsx, .xls) files with password protection
  • Preserves original folder structure in the output
  • Handles already encrypted PDFs with option to decrypt and re-encrypt
  • Creates a new "Protected" folder with the original folder name
  • Provides detailed operation summary and skipped files report

Prerequisites

pip install PyPDF2
pip install msoffcrypto-tool

Usage

fileprotector <input_folder> <password>

Example:

fileprotector "C:\Users\Documents\Reports" MySecurePassword123

This will:

  1. Process all PDF and Excel files in the "Reports" folder and its subfolders
  2. Create a new folder named "Protected Reports"
  3. Save encrypted versions of all files in the new folder
  4. Maintain the original subfolder structure

Supported File Types

  • PDF (.pdf)
  • Excel (.xlsx, .xls)

Error Handling

The script provides comprehensive error handling for:

  • Already encrypted PDFs
  • Invalid files
  • Permission issues
  • Missing folders

A summary is provided after completion showing:

  • Successfully processed files
  • Skipped files with reasons
  • Total count of processed and skipped files

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fileprotector-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fileprotector-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file fileprotector-0.1.0.tar.gz.

File metadata

  • Download URL: fileprotector-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fileprotector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 76179e4bf4ea0a22f709101d24f14fabcfaae85444ae7da69c2dd4faaf812a02
MD5 0c00f15964cb6947ddc6e427f51408d2
BLAKE2b-256 098ae1514370f85eb4d4eed3043e773bf56cb863805d8df1a3a33175502429d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fileprotector-0.1.0.tar.gz:

Publisher: publish.yml on yaliach/file-protector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fileprotector-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fileprotector-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fileprotector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63409e1a8bfa78b7e4044aa0d4a045b21c7bde36e645ca4adb84f82aacb11c88
MD5 0307034bbe0093b693fe7ee9176e9a0e
BLAKE2b-256 00b2e8dc7e189e9ebeb676606a1a620280dee4f75731d0cc6c60ce67fd6816fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for fileprotector-0.1.0-py3-none-any.whl:

Publisher: publish.yml on yaliach/file-protector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page