I have some files in a folde called /images/, the files are
1000.jpg
1000-1.jpg
1000-2.jpg
1001-1.jpg
1001-11jpg
1001-2.jpg
...
I want to reorganize them into
/images/1000/1000.jpg
/images/1000/1000-1.jpg
/images/1000/1000-2.jpg
/images/1001/1001-1.jpg
/images/1001/1001-11.jpg
/images/1001/1001-2.jpg
...
create the new sub-folders 1000, 1001, and move the files into the new sub-folders.
I am not very familiar with the Unix shell scripts. But php should be able to do it too. I am writting php scripts for this task now. But if someone has a unix shell scripts, or a php scripts for this task already, please give me some tips here. Thanks!