Skip to content

Commit 05e4ad4

Browse files
author
FX
committed
sorter
1 parent 792c973 commit 05e4ad4

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

help.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Directory Structure
2+
3+
- **[.]**
4+
- help.md
5+
- readme.md
6+
- **[Arrays]**
7+
- Arrays.md
8+
- **[Advanced]**
9+
- readme.md
10+
- **[DataTypes]**
11+
- readme.md
12+
- **[Composite (Non-Primitive) Data Types]**
13+
- readme.md
14+
- **[Primitive Data Types]**
15+
- readme.md
16+
- **[Methods]**
17+
- readme.md
18+
- **[array-methods]**
19+
- usage.md
20+
- **[date-method]**
21+
- usage.md
22+
- **[math-method]**
23+
- usage.md
24+
- **[number-method]**
25+
- usage.md
26+
- **[object-methods]**
27+
- usage.md
28+
- **[promise-method]**
29+
- usage.md
30+
- **[string-methods]**
31+
- course.md
32+
- examples.md
33+
- **[Operators]**
34+
- Operators.md

index.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import os
2+
3+
def generate_directory_structure(directory):
4+
structure = []
5+
6+
for root, dirs, files in os.walk(directory):
7+
# Exclude the .git directory
8+
dirs[:] = [d for d in dirs if d != '.git']
9+
10+
# Build the directory path
11+
path_parts = root.replace(directory, '').strip(os.sep).split(os.sep)
12+
indent = ' ' * len(path_parts)
13+
if dirs or files:
14+
structure.append(f'{indent}- **[{os.path.basename(root)}]**')
15+
16+
# Add Markdown files within this directory
17+
for f in files:
18+
if f.endswith('.md'):
19+
file_indent = ' ' * (len(path_parts) + 1)
20+
structure.append(f'{file_indent}- {f}')
21+
22+
return '\n'.join(structure)
23+
24+
directory = '.' # Replace with the path to your directory
25+
structure = generate_directory_structure(directory)
26+
output = f'# Directory Structure\n\n{structure}'
27+
28+
with open('help.md', 'w') as f:
29+
f.write(output)
30+
31+
print(output)

0 commit comments

Comments
 (0)