The following command:
find . -name \"file2015-0*\" -exec mv {} .. \\;
Affects about 1500 results. One by one they move a previous level.
You can for example provide the find
output into a while read
loop and keep track with a counter:
counter=1
while IFS= read -r file
do
[ "$counter" -ge 400 ] && exit
mv "$file" ..
((counter++))
done < <(find . -name "file2015-0*")
Note this can lead to problems if the file name contains new lines... which is quite unlikely. Also, note the mv
command is now moving to the upper level. If you want it to be related to the path of the dir, some bash conversion can make it.
You can do this:
find . -name "file2015-0*" | head -400 | xargs -I filename mv filename ..
If you want to simulate what it does use echo
:
find . -name "file2015-0*" | head -400 | xargs -I filename echo mv filename ..