folder script
This commit is contained in:
parent
81bbb7b1d7
commit
37da020523
297 changed files with 3295 additions and 0 deletions
21
scripts/organize.sh
Executable file
21
scripts/organize.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Regex pattern for ISO date format filenames like 2019-06-01-something.md
|
||||
pattern='^[0-9]{4}-[0-9]{2}-[0-9]{2}-.+\.md$'
|
||||
|
||||
echo "Processing markdown files in $(pwd)"
|
||||
echo
|
||||
|
||||
for file in *.md; do
|
||||
# Skip if no matching files (glob doesn't find anything)
|
||||
[ -e "$file" ] || continue
|
||||
|
||||
if [[ "$file" =~ $pattern ]]; then
|
||||
basename="${file%.md}"
|
||||
mkdir -p "$basename"
|
||||
mv "$file" "$basename/index.md"
|
||||
echo "✔ Processed: $file → $basename/index.md"
|
||||
else
|
||||
echo "✘ Skipped (pattern mismatch): $file"
|
||||
fi
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue