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

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -