mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-06 21:17:14 -06:00
19 lines
496 B
Bash
19 lines
496 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
|
||
|
|
for file in *; do
|
||
|
|
# Check if it's a file (not a directory)
|
||
|
|
if [ -f "$file" ]; then
|
||
|
|
# Get filename without extension
|
||
|
|
dirname="${file%.*}"
|
||
|
|
|
||
|
|
# Create directory if it doesn't exist
|
||
|
|
if [ ! -d "$dirname" ]; then
|
||
|
|
mkdir "$dirname"
|
||
|
|
echo "Created directory: $dirname"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Move the file into its directory
|
||
|
|
mv "$file" "$dirname/"
|
||
|
|
echo "Moved $file to $dirname/"
|
||
|
|
fi
|
||
|
|
done
|