I have a directory with 52 subdirectories, and I'd like to split them in 11 folders with 5 subdirectories each of them.Can anyone suggest me a way to achieve this?
How to split the subdirectories of a directory in n parts?
bash
In the first place, you're asking for a mathematical impossibility, but I'll overlook it. The basic thing you ask is very simply done:[ ! -e split ]       &&set ./*/             &&while  mkdir split   &&  [ 4 -lt $# ]do     mv $1 $2 $3 $4 $5 split       mv split ${1%/}       shift 5done&& mv $@ split && mv split ${1%/}Because you don't specify any kind of names or similar that takes some care to avoid overwriting anything, and winds up just moving every 5 directories as sorted lexicographically into a directory named for every 5th. That is, it does so if there is no file or directory in the current directory named split