Last active
March 27, 2018 23:18
-
-
Save jihyeonRyu/e9684a46d0c5a69f794eb7e9b4a88f6b to your computer and use it in GitHub Desktop.
classify files by name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# filename: aaa-01.jpg, bbb-01.jpg | |
for file in *.jpg ; do | |
arr=(${file//-/ }) | |
dir=dir/${arr[0]} | |
[[ -d $dir ]] || mkdir -p "$dir" | |
mv "$file" "$dir" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment