mirror of
https://github.com/kuhyx/scripts.git
synced 2026-07-04 15:43:17 +02:00
feat: add script for sorting download and home foldeer
This commit is contained in:
parent
d74ea53b89
commit
9aaeca58c4
25
scripts/sort_downloads.sh
Executable file
25
scripts/sort_downloads.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to sort files in a given directory
|
||||
sort_files() {
|
||||
local dir=$1
|
||||
cd "$dir"
|
||||
|
||||
# Create directories if they do not exist
|
||||
mkdir -p images videos documents
|
||||
|
||||
# Move video files to the videos folder
|
||||
mv *.webm *.mp4 *.mkv *.avi *.mov *.flv videos/ 2>/dev/null
|
||||
|
||||
# Move image files to the images folder
|
||||
mv *.png *.jpg *.jpeg *.gif *.webp *.bmp images/ 2>/dev/null
|
||||
|
||||
# Move document files to the documents folder
|
||||
mv *.pdf *.doc *.docx *.txt *.odt documents/ 2>/dev/null
|
||||
}
|
||||
|
||||
# Sort files in the Downloads folder
|
||||
sort_files ~/Downloads
|
||||
|
||||
# Sort files in the home folder
|
||||
sort_files ~
|
||||
Loading…
Reference in New Issue
Block a user