A possible solution to mv
150 files:
mv `find ./ -maxdepth 1 -type f | head -n 150` "$destdir"
Swap out mv
for cp
to copy instead.
Here is a test case:
mkdir d1 d2
cd d1
touch a b c d e f g h i j k l m n o p
cd ../
mv `find ./d1 -type f | head -n 5` ./d2/
And the result:
ls d1 d2
d1:
b c d e g h i k m n o
d2:
a f j l p
Edit:
Here is a simple script that will answer your comment:
#!/bin/sh
# NOTE: This will ONLY WORK WITH mv.
# It will NOT work with cp.
#
# How many files to move
COUNT=150
# The dir with all the files
DIR_MASTER="/path/to/dir/with/files"
# Slave dir list - no spaces in the path or directories!!!
DIR_SLAVES="/path/to/dirB /path/to/dirC /path/to/dirD"
for d in $DIR_SLAVES
do
echo "Moving ${COUNT} to ${d}..."
mv `find ${DIR_MASTER} -maxdepth 1 -type f | head -n ${COUNT}` "${d}"
done
exit
NOTE: The sample script has not been tested, but should work.