user1015214 user1015214 - 9 months ago 33
Linux Question

How to pipe the results of 'find' to mv in Linux

How do I pipe the results of a 'find' (in Linux) to be moved to a different directory? This is what I have so far.

find ./ -name '*article*' | mv ../backup 

but its not yet right (I get an error missing file argument, because I didn't specify a file, because I was trying to get it from the pipe)

find ./ -name '*article*' -exec mv {}  ../backup  \;


find ./ -name '*article*' | xargs -I '{}' mv {} ../backup