Skip to content

Commit

Permalink
sorter
Browse files Browse the repository at this point in the history
  • Loading branch information
FX committed Aug 10, 2024
1 parent 792c973 commit 05e4ad4
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
34 changes: 34 additions & 0 deletions help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Directory Structure

- **[.]**
- help.md
- readme.md
- **[Arrays]**
- Arrays.md
- **[Advanced]**
- readme.md
- **[DataTypes]**
- readme.md
- **[Composite (Non-Primitive) Data Types]**
- readme.md
- **[Primitive Data Types]**
- readme.md
- **[Methods]**
- readme.md
- **[array-methods]**
- usage.md
- **[date-method]**
- usage.md
- **[math-method]**
- usage.md
- **[number-method]**
- usage.md
- **[object-methods]**
- usage.md
- **[promise-method]**
- usage.md
- **[string-methods]**
- course.md
- examples.md
- **[Operators]**
- Operators.md
31 changes: 31 additions & 0 deletions index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os

def generate_directory_structure(directory):
structure = []

for root, dirs, files in os.walk(directory):
# Exclude the .git directory
dirs[:] = [d for d in dirs if d != '.git']

# Build the directory path
path_parts = root.replace(directory, '').strip(os.sep).split(os.sep)
indent = ' ' * len(path_parts)
if dirs or files:
structure.append(f'{indent}- **[{os.path.basename(root)}]**')

# Add Markdown files within this directory
for f in files:
if f.endswith('.md'):
file_indent = ' ' * (len(path_parts) + 1)
structure.append(f'{file_indent}- {f}')

return '\n'.join(structure)

directory = '.' # Replace with the path to your directory
structure = generate_directory_structure(directory)
output = f'# Directory Structure\n\n{structure}'

with open('help.md', 'w') as f:
f.write(output)

print(output)

0 comments on commit 05e4ad4

Please sign in to comment.