Skip to main content
TopMiniSite

Back to all posts

How to Add Folder Using Pyinstaller Command?

Published on
3 min read
How to Add Folder Using Pyinstaller Command? image

Best Python Automation Tools to Buy in November 2025

1 Python Cheat Sheet Desk Mat for Software Engineers, Hackers and Programmers, Quick Key, Large Anti-Slip Keyboard Pad Mouse Mat KMH

Python Cheat Sheet Desk Mat for Software Engineers, Hackers and Programmers, Quick Key, Large Anti-Slip Keyboard Pad Mouse Mat KMH

  • SPACIOUS DESIGN FITS MOUSE, KEYBOARD, AND ACCESSORIES EFFORTLESSLY.
  • ULTRA-SMOOTH SURFACE ENSURES PRECISION AND SPEED FOR GAMING.
  • NON-SLIP RUBBER BASE KEEPS THE MAT SECURELY IN PLACE.
BUY & SAVE
$31.99
Python Cheat Sheet Desk Mat for Software Engineers, Hackers and Programmers, Quick Key, Large Anti-Slip Keyboard Pad Mouse Mat KMH
2 Python Tools for Scientists: An Introduction to Using Anaconda, JupyterLab, and Python's Scientific Libraries

Python Tools for Scientists: An Introduction to Using Anaconda, JupyterLab, and Python's Scientific Libraries

BUY & SAVE
$38.23 $49.99
Save 24%
Python Tools for Scientists: An Introduction to Using Anaconda, JupyterLab, and Python's Scientific Libraries
3 Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems

Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems

  • TRACK ML PROJECTS END-TO-END WITH SCIKIT-LEARN INSIGHTS!
  • EXPLORE DIVERSE MODELS: SVMS, TREES, FORESTS, AND ENSEMBLES!
  • MASTER NEURAL NETWORKS WITH TENSORFLOW AND KERAS TUTORIALS!
BUY & SAVE
$46.95 $89.99
Save 48%
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
4 Python for Excel: A Modern Environment for Automation and Data Analysis

Python for Excel: A Modern Environment for Automation and Data Analysis

BUY & SAVE
$39.98 $65.99
Save 39%
Python for Excel: A Modern Environment for Automation and Data Analysis
5 Think Python: How to Think Like a Computer Scientist

Think Python: How to Think Like a Computer Scientist

BUY & SAVE
$34.73 $48.99
Save 29%
Think Python: How to Think Like a Computer Scientist
6 Python Data Science Handbook: Essential Tools for Working with Data

Python Data Science Handbook: Essential Tools for Working with Data

BUY & SAVE
$44.18 $79.99
Save 45%
Python Data Science Handbook: Essential Tools for Working with Data
7 Python Programming Language: a QuickStudy Laminated Reference Guide

Python Programming Language: a QuickStudy Laminated Reference Guide

BUY & SAVE
$8.95
Python Programming Language: a QuickStudy Laminated Reference Guide
8 Python and SQL Bible: From Beginner to World Expert: Unleash the full potential of data analysis and manipulation by mastering Python and SQL

Python and SQL Bible: From Beginner to World Expert: Unleash the full potential of data analysis and manipulation by mastering Python and SQL

BUY & SAVE
$39.90
Python and SQL Bible: From Beginner to World Expert: Unleash the full potential of data analysis and manipulation by mastering Python and SQL
+
ONE MORE?

To add a folder using PyInstaller command, you can specify the folder path in the command line. When running PyInstaller, you can use the --add-data flag followed by the path to the folder you want to include. For example, if you have a folder named "images" that you want to add, you can use the following command:

pyinstaller --onefile --add-data "images;images" your_script.py

This command tells PyInstaller to add the "images" folder to the bundled executable. The first "images" before the semicolon specifies the source folder location, and the second "images" after the semicolon specifies the destination folder name. This way, when the program is run, the "images" folder will be included in the executable and accessible to your script.

How to include a folder in PyInstaller build in a single command?

Unfortunately, PyInstaller does not have a built-in option to include an entire folder in a single command. However, you can achieve this by using the --add-data flag to include all the files in a folder.

Here's an example command to include an entire folder named data_folder in the PyInstaller build:

pyinstaller --onefile --add-data "data_folder;data_folder" your_script.py

In this command:

  • --onefile flag creates a single standalone executable file
  • --add-data "data_folder;data_folder" flag specifies that all files in the data_folder should be included in the build. The first data_folder is the source directory, and the second one is the destination directory in the build.

Replace your_script.py with the name of your Python script. This command will include all files in the data_folder in the PyInstaller build.

What is the command syntax for adding a folder in PyInstaller build?

The command syntax for adding a folder in PyInstaller build is as follows:

pyinstaller --add-data "path_to_folder;folder_name" your_script.py

Explanation:

  • pyinstaller: command to run PyInstaller
  • --add-data: option to add a folder into the build
  • "path_to_folder;folder_name": specify the path to the folder that you want to add and the name of the folder in the build
  • your_script.py: the name of the script file that you want to bundle into an executable

For example, if you want to add a folder named "images" located at "C:\Users\Username\Project\images" into the PyInstaller build, the command would be:

pyinstaller --add-data "C:\Users\Username\Project\images;images" your_script.py

How to add a folder to a PyInstaller command?

To add a folder to a PyInstaller command, you can use the --add-data flag followed by the path to the folder you want to include. Here is an example command to add a folder named data_folder to a PyInstaller command:

pyinstaller --add-data "path/to/data_folder:data_folder" your_script.py

This command will include the data_folder directory in the packaged executable. The syntax for specifying the folder to include is source:destination, where source is the path to the folder on your system and destination is the path to the folder in the packaged executable.

Make sure to replace path/to/data_folder with the actual path to the folder you want to include, and your_script.py with the name of your Python script.