Skip to content

Commit

Permalink
Update 2024-05-30-files-by-type.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ibbsbbr authored Jun 1, 2024
1 parent f288f7e commit cb9c4f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _posts/2024-05-30-files-by-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ fi
cd "$FOLDER" || exit

# Get a list of unique file extensions
file_extensions=$(find . -maxdepth 1 -type f | sed -n 's/.*\.\([a-zA-Z0-9]*\)$/\1/p' | sort | uniq)
file_extensions=$(find . -type f | sed -n 's/.*\.\([a-zA-Z0-9]*\)$/\1/p' | sort | uniq)

# Create directories for each file extension and move files
for ext in $file_extensions; do
mkdir -p "$ext"
find . -maxdepth 1 -type f -name "*.$ext" -exec mv {} "$ext" \;
find . -type f -name "*.$ext" -exec mv {} "$ext" \;
done

echo "Files have been organized by file type."
Expand Down

0 comments on commit cb9c4f4

Please sign in to comment.