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 October 2025

1 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
$29.99
Python Tools for Scientists: An Introduction to Using Anaconda, JupyterLab, and Python's Scientific Libraries
2 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

  • MASTER ML WITH SCIKIT-LEARN FOR END-TO-END PROJECT TRACKING.
  • EXPLORE DIVERSE MODELS FROM SVMS TO ENSEMBLE METHODS EFFORTLESSLY.
  • UNLOCK NEURAL NET POTENTIAL USING TENSORFLOW AND KERAS TOOLS.
BUY & SAVE
$49.50 $89.99
Save 45%
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
3 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
4 Hypermodern Python Tooling: Building Reliable Workflows for an Evolving Python Ecosystem

Hypermodern Python Tooling: Building Reliable Workflows for an Evolving Python Ecosystem

BUY & SAVE
$37.53 $65.99
Save 43%
Hypermodern Python Tooling: Building Reliable Workflows for an Evolving Python Ecosystem
5 Deep Learning with PyTorch: Build, train, and tune neural networks using Python tools

Deep Learning with PyTorch: Build, train, and tune neural networks using Python tools

BUY & SAVE
$34.40 $49.99
Save 31%
Deep Learning with PyTorch: Build, train, and tune neural networks using Python tools
6 Strong Hand Tools, The Python, Pipe Alignment Chain Pliers, Adjustable Stainless-Steel Contacts, Replaceable Nickel Plated 48" Chain, 14" Max Diameter, PCA2048

Strong Hand Tools, The Python, Pipe Alignment Chain Pliers, Adjustable Stainless-Steel Contacts, Replaceable Nickel Plated 48" Chain, 14" Max Diameter, PCA2048

  • PRECISION ALIGNMENT SCREWS ENHANCE WELD ACCURACY AND JOB QUALITY.
  • REPLACEABLE 48 NICKEL-PLATED CHAIN FOR EASY INSERTION AND DURABILITY.
  • QUICK-RELEASE LOCKING PLIER FOR FAST, EFFICIENT SETUP AND OPERATION.
BUY & SAVE
$160.00
Strong Hand Tools, The Python, Pipe Alignment Chain Pliers, Adjustable Stainless-Steel Contacts, Replaceable Nickel Plated 48" Chain, 14" Max Diameter, PCA2048
7 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
8 Programming Computer Vision with Python: Tools and algorithms for analyzing images

Programming Computer Vision with Python: Tools and algorithms for analyzing images

BUY & SAVE
$28.99 $59.99
Save 52%
Programming Computer Vision with Python: Tools and algorithms for analyzing images
+
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.