Divide files depending on X and put into individual folder
How do I create a script in a command prompt (or shell script in a bash) to divide files depending on a number, say X, and put into individual folder.

Example: I have 10 files and the number X is 4 (I can set it inside the script). So, the system will create 3 folders (1st folder contain 4 files, 2nd folder contain 4 files and the last folder will contain the remaining 2 files) after running the script.

Regarding about the divide of the files. It can be either go by the date or the filename.

Example: Suppose the 10 files above is a.txt, aa.txt, b.txt, cd.txt, ef.txt, g.txt, h.txt, iii.txt, j.txt and zzz.txt. After running the script, it will create the 3 folders such that the 1st folder contain a.txt, aa.txt, b.txt, cd.txt, the 2nd folder contains ef.txt, g.txt, h.txt, iii.txt and the last folder will contain the remaining files - j.txt and zzz.txt

Divide files depending on X and put into individual folder
===

How do I create a script in a command prompt (or shell script in a bash) to divide files depending on a number, say X, and put into individual folder.

Example: I have 10 files and the number X is 4 (I can set it inside the script). So, the system will create 3 folders (1st folder contain 4 files, 2nd folder contain 4 files and the last folder will contain the remaining 2 files) after running the script.

Regarding about the divide of the files. It can be either go by the date or the filename.

Example: Suppose the 10 files above is a.txt, aa.txt, b.txt, cd.txt, ef.txt, g.txt, h.txt, iii.txt, j.txt and zzz.txt. After running the script, it will create the 3 folders such that the 1st folder contain a.txt, aa.txt, b.txt, cd.txt, the 2nd folder contains ef.txt, g.txt, h.txt, iii.txt and the last folder will contain the remaining files - j.txt and zzz.txt
