Skip to content

Commit

Permalink
iiitl#7 Added more special cases to extarrange script.
Browse files Browse the repository at this point in the history
@rootCircle I have made required changes. Kindly review it.
  • Loading branch information
M-ayank2005 committed Mar 16, 2024
1 parent 96850b2 commit 1a929ec
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/extarrange
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ require egrep

declare -A special_cases=(
['^*.(tar.*|tbz)$']='tar'
['\.rar$']='rar'
['\.doc$']='doc'
['\.(jpg|jpeg|png|gif|bmp)$']='img'
['\.mp3$']='mp3'
['\.(mp4|avi|mkv)$']='videos' # Example pattern for grouping video files
# TODO: Add your own pattern here for similar file types appropriately
# Refer https://regex101.com/ & https://github.com/ziishaned/learn-regex/ for explaination and writing patterns
# Refer https://regex101.com/ & https://github.com/ziishaned/learn-regex/ for explanation and writing patterns
# These (regex) are same as ones used in sed command
)

Expand All @@ -27,7 +32,10 @@ fd -tf -d1 \
}
done

mkdir -p "$folder"
# Check if the directory already exists before creating it
if [ ! -d "$folder" ]; then
mkdir -p "$folder"
fi

mv "$file" "$folder"
done

0 comments on commit 1a929ec

Please sign in to comment.