files management

Hi, please help me.

I have N files which are tif images, and they are in one folder. They are labeled 1.tif, 2.tif, ... , N.tif .
I would like to create N/m folders in the same folder (where my N files are) labelled 1, 2,...,N/m.
And then put m files in each folder in the following order: first m files of N (say 1.tif to 5.tif) go in the folder called "1", second m files (say 6.tif to 10.tif) go into folder "2", and etc.
so that basically i need a function that sorts my files into the folders and this function's input would be N, m and pathname of the folder where my files are located.

Thank you very much in advance
Vyacheslav
I would recommend that you read the Igor command help for the following operations:
IndexedFile
CopyFile
CopyFolder
MoveFile
MoveFolder

It doesn't appear that Igor has a NewFolder or similar command that can create a new directory on the disk. However, I suspect that you could use CopyFolder, which probably has the side effect of creating the destination folder if it does not already exist. CopyFile and/or MoveFile might also create the directory if it doesn't already exist.

I suspect that you'll want to pass -1 as the value of the index parameter to IndexedFile, because doing so will give you a list of all file names in a directory. Then you can sort those however you'd like, and then use a loop to copy certain files to the target directory.
New folders can be created with:
 newPath/C pathName,<your folder path>

Regards,
Patrick.