user1015214 user1015214 - 1 year ago 89
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)

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


find ./ -name '*article*' | xargs -I '{}' mv {} ../backup
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download