Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A python CLI script to 𝗰𝗼𝗺𝗽𝗿𝗲𝘀𝘀 📦 all the 𝗣𝗗𝗙 files 𝗿𝗲𝗰𝘂𝗿𝘀𝗶𝘃𝗲𝗹𝘆 in a directory using the iLovePDF technology 🥰

License

NotificationsYou must be signed in to change notification settings

Josee9988/Compress-PDFs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
IssuesGitHub pull requests

⚠️This project is not fully finished or tester, it might cause some errors with in certain situations. Please, do a backup of the folders you want to compress before using this script.⚠️


🤔About the project

  • A CLI tool to compress 📦 all PDFs recursively in a directory.

Installation

  1. Clone the repository andcd into it

    git clone git@github.com:Josee9988/Compress-PDFs.git&&cd Compress-PDFs
  2. Install pip3

    sudo apt install python3-pip# verify it with pip3 --version
  3. Instal the ilovepdf dependency

    pip3 install pylovepdf
  4. Make the script executable from anywhere

    bash MAKE_SCRIPT_GLOBAL.sh
  5. Rename.env.example to.env.

    mv -v .env.example .env# rename to .env
  6. Add yourIlovePDF public key

  7. Run it ;)

    compress.py /RELATIVE/OR/ABSOLUTE/PATH/TO/YOUR/DIR/

🚀Usage

  • After running the scriptMAKE_SCRIPT_GLOBAL.sh you can call the script from anywhere in your system with:compress.py <path>

  • The script receives only one argument and it is the path of the directory that will be recursively compressed. All the subfolders will be looked up to compress all the pdfs inside the passed directory as an argument.

  • Script profile

    compress.py<Directory path>
  • Some examples of usage

    1. Using an absolute path

      compress.py /home/username/Documents/MyFolder
    2. Using a relative path

      compress.py.
      compress.py /dirFromWhereIAm/whatever/

🌲Project tree

.├── compress.py├── .env├── .github│   ├── CODE_OF_CONDUCT.md│   ├── CODEOWNERS│   ├── config.yml│   ├── CONTRIBUTING.md│   ├── FUNDING.yml│   ├── issue_label_bot.yaml│   ├── ISSUE_TEMPLATE│   │   ├── 1-bug-report.md│   │   ├── 2-failing-test.md│   │   ├── 3-docs-bug.md│   │   ├── 4-feature-request.md│   │   ├── 5-enhancement-request.md│   │   ├── 6-security-report.md│   │   ├── 7-question-support.md│   │   └── config.yml│   ├── ISSUE_TEMPLATE.md│   ├── pull_request_template.md│   ├── SECURITY.md│   ├── settings.yml│   └── SUPPORT.md├── .gitignore├── LICENSE├── MAKE_SCRIPT_GLOBAL.sh└── README.md2 directories, 25 files

📝Additional notes

  • The compressed PDF's will automatically replace your old and uncompressed ones.
  • In case an error happens because there are multiple pdfs with the same name or simply the program doesn't know how to replace them, an error will be prompt and you will have to manually move the compressed pdf (which will be in the directory passed as an argument) to the desired directory.
  • The cloned repository should not be removed as it contains the symbolic link which is globally executable. You can manually move the file and the .env file to your /bin/ folder if you wish.

Compress-PDFs was generated fromJosee9988/project-template 📚


🕵️ Extra recommendations

  • Always check the console output to check if any error happened and if so, you will have to manually move the non-moved compressed file to its location.

  • Also, always perform a copy of the folder before using the script as it will remove the old PDFs, and it might cause some data loss if an error occurs.


🎉 Was the pdf compressor helpful? Help us raise these numbers up

Github followersGithub starsGithub watchersGithub forksSponsor

Enjoy! 😃


⚖️📝License

See the license in the 'LICENSE' file.


Made with a lot of ❤️❤️ by@Josee9988

About

A python CLI script to 𝗰𝗼𝗺𝗽𝗿𝗲𝘀𝘀 📦 all the 𝗣𝗗𝗙 files 𝗿𝗲𝗰𝘂𝗿𝘀𝗶𝘃𝗲𝗹𝘆 in a directory using the iLovePDF technology 🥰

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

[8]ページ先頭

©2009-2025 Movatter.jp