Script to count and move files into subdirs
Hi - first time posting in the programming forum
I have a recurring task that I'm sure a script can handle easily, but I have no idea on how to construct it. I searched our forums here and didn't find anything close to what I wanted, that I could modify. Anyway, I'm hoping someone can help me out.
Here's the task: I have a directory with a lot of pictures in it, say 3000 (although it could be more or less than 3000). I want a script to move these 3000 pictures into subdirectories with 500 pictures per subdir. The subdirs do not already exist and so the script will need to create them. The subdirs can be named simply 1, 2 ,3, etc. Once the pictures are moved, then no more subdirs are needed and the script can end.
In researching this, it looks like a loop process could be employed, or maybe use a command that can count files (if that exists). I read through the bash command reference, but I was pretty confused after reading it
Thanks in advance for the help!
A computer without Microsoft is like a chocolate cake without mustard.
Bookmarks