sometimes you find yourself in the position were you want to gradually move files from one location to another (to be processed for instance) you don’t to move the files all at once and you don’t have a certain criteria to limit your find command with. I’d have expected find to have an argument that’d would control the number of files returned but it doesn’t instead you have to use a counter and for loop to force the script to exit after moving certain number of files.
I’ve written a rather simple script to do that and here it is, I’m sure there is a more elegant way to do this however I wrote this as a quick and dirty fix.
for file in `ls -t`
mv $file tempdir;
if [ “$i” -eq 6 ]