4Geeks logo
4Geeks logo

Courses

Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.

Coding Bootcamp

Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Full-Stack Software Developer - 16w

Data Science and Machine Learning - 16 wks

Search from all Lessons


LoginGet Started
← Back to Projects

File Hierarchy Report

Goal

4Geeks Coding Projects tutorials and exercises for people learning to code or improving their coding skills

Difficulty

easy

Repository

Click to open

Video

Not available

Solution video

Not available

Average duration

8 hrs

Technologies

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge

Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast

Another data-structure very commonly used in the world of coding are TREE's, for example:

  1. The computer file system is a Tree.
  2. The DOM (Document Object Model) is a Tree.

In this case, we will use the Tree Hierarchy concept to scan and browse through a group of files in a computer.

🌱 How to start this project

Do not clone this repository.

  1. The first step to start coding is cloning the python boilerplate on your local computer or opening it using gitpod.

a) If using Gitpod (recommended) you can clone the boilerplate by clicking here.

b) If working locally type the following command from your command line:

1https://github.com/4GeeksAcademy/flask-rest-hello
  1. Install the dependency packages by typing:
1$ pipenv install --python 3
  1. Get inside your virtual environment by typing:
1$ pipenv shell
  1. You can run the project by typing:
1$ python src/app.py
  1. You can also run the tests for the project:
1$ python src/test.py

πŸ’‘ Important: Remember to create a new repository, update the remote (git remote set-url origin <your new url>), and upload the code to your new repository using add, commit and push.

πŸ“ Instructions

Given the set of files under the data-files folder, please write a program that creates a JSON file called report.json that outputs the following report:

1{ 2 "levels": 3, 3 "total_files_found": 5, 4 "files_found": ["file_one.csv", "file_two.json"], 5 "file_extentions_found": ["csv", "json"], 6 "total_folders_found": 3, 7 "folders_found": ["folder_one","folder_tow"], 8 "links_found": 12, 9 "broken_links_found": 4, 10}

Report explanation:

PropertyDescription
levelsNumber of connections between the top node and the lowest node
total_files_foundhow many files were found, folders don't count
files_foundthe name of each of the files found, without folders
file_extentions_founda non-repeated list of the file extensions found inside the tree
total_folders_foundtotal amount of folders found, files don't count
Links foundHow many URL's were found starting with http or https
broken_links_foundHow many of the links were broken (you have to do a GET request and check for 404)

πŸ’‘ Hint

  1. Start by looking python get files in folder on google.
  2. This query also helps: python file is directory to check if a file is a directory or not.
  3. To google how to find links inside the file content: python find all links in string
  4. Get extension from file name: python get file extension

Goal

4Geeks Coding Projects tutorials and exercises for people learning to code or improving their coding skills

Difficulty

easy

Repository

Click to open

Video

Not available

Solution video

Not available

Average duration

8 hrs

Technologies

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge

Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast