I think your logic is flawed with your find example.
find . -type f | ls -ltr | head -n 10000 -exec mv {} directory/ \;
This runs the 'ls -ltr' command on ONE FILE then it runs 'head -n 10000' on that ONE FILE. And since you've passed the rest of your find command arguments (the '-exec mv {} directory/ \;' part) are being passed as arguments to the head command you're getting nowhere fast.
I suggest you pick a cutoff date for old files in that directory. Then use the find command to move those.
So here we've moved all files that haven't been modified in at least 130 days to /some/other/dir/.
The '-xdev' prevents us from searching other filesystems within the current mountpoint. If you wish to search those filesystems then simply remove the '-xdev'.
Please test your command with a different variation of the find example above before you run this on your live system to make sure it does what you expect.
Something like this perhaps:
/usr/bin/find . -mtime +130 -type f -xdev -ls
Simply shows you which files meet the criteria you specified in the find command.
I'm using this following command but its erroring out !!
find /home/xxx/yyy/ . -mtime -7 -type f -exec mv {} /home/xxx/yyy/zzz/
" find: 0652-018 An expression term lacks a required parameter. " -- This is the error i get... My basic requirement here is to move files which are 7 days old !!...
I have tried at the prompt also giving same command but same error is popping up. please suggest what might be the problem here..