Skip to content

Commit

Permalink
Create index.html file with a heading
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavasana authored Dec 3, 2024
1 parent 6a22967 commit 19479cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion generate_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ def generate_index(dir_path):
# Skip if the directory is empty
if not files:
return

# Get the name of the directory for the heading
dir_name = os.path.basename(dir_path)

# Create index.html file
index_content = '<html><body><h1>Directory Listing</h1><ul>'
index_content = f'<html><body><h1>Index of {dir_name}</h1><ul>'

for file in files:
file_path = os.path.join(dir_path, file)
Expand Down

0 comments on commit 19479cb

Please sign in to comment.