COUNTER=0 for i in $( `ls /path/path/path` ); do if [ "$COUNTER" = "1001" ]; then exit 0 fi mv $i /path/to/move/to let COUNTER=COUNTER+1 done