Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PyTreefy is a Python script designed to explore a specified directory, generate a visual representation of its directory tree, and collect all Python scripts (*.py) present in that directory. The collected scripts are then combined with the directory tree structure and written to an output file.

License

Notifications You must be signed in to change notification settings

infinition/PyTreefy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

#PyTreefy

IMG_0846

##PyTreefy is a Python script designed to explore a specified directory, generate a visual representation of its directory tree, and collect all Python scripts (*.py) present in that directory. The collected scripts are then combined with the directory tree structure and written to an output file.

Directory Tree Generation: Creates a visual representation of the directory structure, including subdirectories and files. Python Script Collection: Collects and concatenates the contents of all Python scripts located in the specified directory. Output File Creation: Writes the directory tree and collected Python scripts to a single output file. Installation Ensure you have Python 3.x installed on your system.

Clone the repository or download the script directly:

git clone https://github.com/infinition/pytreefy.git cd pytreefy Usage To run the script, follow these steps:

Navigate to the script directory:

cd path/to/pytreefy Run the script:

python pytreefy.py Provide the required input: The script will prompt you to enter the path of the directory you wish to explore.

Example:

Entrez le chemin du répertoire à explorer: /path/to/directory Output: The script will generate an output file named output.txt in the specified directory. This file will contain the directory tree and the contents of all Python scripts found.

Example

Run the script

python pytreefy.py

Sample input prompt

Entrez le chemin du répertoire à explorer: /home/user/projects

Output

Les scripts ont été collectés et écrits dans /home/user/projects/output.txt Script Details generate_directory_tree(root_dir) This function generates a visual representation of the directory tree.

Parameters: root_dir (str): The root directory to explore. Returns: A string representing the directory tree structure. collect_python_scripts(directory) This function collects and concatenates the contents of all Python scripts in the specified directory.

Parameters: directory (str): The directory to search for Python scripts. Returns: A string containing the concatenated contents of all Python scripts. write_to_output_file(output_file, text) This function writes the provided text to the specified output file.

Parameters: output_file (str): The path to the output file. text (str): The text to write to the file. Example Output The output.txt file generated by the script will have the following structure:

Arborescence des fichiers:

directory/ subdirectory1/ file1.py file2.txt subdirectory2/ file3.py file4.py

File: file1.py

Path: /path/to/directory/subdirectory1/file1.py

File: file3.py

Path: /path/to/directory/subdirectory2/file3.py

File: file4.py

Path: /path/to/directory/file4.py

License This project is licensed under the MIT License. See the LICENSE file for details.

About

PyTreefy is a Python script designed to explore a specified directory, generate a visual representation of its directory tree, and collect all Python scripts (*.py) present in that directory. The collected scripts are then combined with the directory tree structure and written to an output file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages