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
# Dumps all files into the same folder | |
folders=($(ls targets/)) | |
find source/ -type f -print0 | \ | |
xargs -r0 -P 10 -I{} \ | |
mv --target-directory=targets/${folders[$(expr $RANDOM % ${#folders[@]})]}/ |
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
# As an example, how to randomly distribute files to a collection of folders | |
find source/ -type f -print0 | \ | |
xargs -r0 -P 10 -I{} sh -c " | |
folders=($(ls targets/)) | |
mv --target-directory=targets/\${folders[\$(expr \$RANDOM % \${#folders[@]})]}/ | |
" |
NewerOlder