Created
April 5, 2022 13:11
-
-
Save MewX/4fff673387bf7e4d150a6b7d6724c4cb to your computer and use it in GitHub Desktop.
Split files in one directory into two directories randomly.
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
from_dir="." | |
save_dirs=("dir1" "dir2") | |
ls "$from_dir" |sort -R |tail -$N |while read file; do | |
echo mv "\"$from_dir/$file\"" "${save_dirs[RANDOM%${#save_dirs[@]}]}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment