linux - Grouping TXT files -
i've been trying group big list of txt files sub folders, each containing random 5 files. i.e. pick 5 random files, create new folder group x, , move them it.
any appreciated. thanks.
this straightforward:
#!/bin/bash mkdir -p groupx in `seq 1 5`; files=($( ls *.txt )) ran=`expr $random % ${#files[@]}` echo moving "${files[$ran]}" folder groupx mv "${files[$ran]}" groupx done
warning, no checking if there less 5 txt files in directory.
Comments
Post a Comment