Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

limiting a find to 100 results 1

Status
Not open for further replies.

bkdobs

Technical User
Sep 22, 2005
33
CA
Is it possible to limit a find to 100 results?

find $srcpath -xdev -type f exec mv {} $dstpath \;

The issue is when too many files hit the srcpath a
mv $srcpath\*.* $dstpath
fails due to parameter list too large ... the dstpath processes will fail for the same reason if I execute the above find.
 
How about;

set -A move `find $srcpath -xdev -type f exec mv {} $dstpath \; x=0 ; while [ $x -lt 100 ] #(array starts @ 0)
do
echo ${move[$x]}
((x=$x+1))
done


recl
 
or rather;

set -A move `find $srcpath -xdev -type f exec mv {} $dstpath \; x=0 ; while [ $x -lt 100 ] #(array starts @ 0)
do
mv ${move[$x]}$dstpath
((x=$x+1))
done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top