Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

this command finds me files which I want to move to old folder

find /home/ -maxdepth 1 -type f -mtime +1

now how I cann result of this command to move command

mv (previous files) /old
share|improve this question

migrated from Mar 4 '13 at 15:56

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

You can also use xargs.

find /home/ -maxdepth 1 -type f -mtime +1 | xargs mv -I '{}' mv {} /old/
share|improve this answer
You meant xargs -I '{}' mv {} /old/ – anishsane Mar 4 '13 at 13:42
Wow, I thought it would be enough with what I wrote. Thank you, now I see it was not complete and yours is working, @anishsane. – fedorqui Mar 4 '13 at 13:44
thx anishame ur fix works perfectly – hudi Mar 4 '13 at 13:44
We should give this +something to @anishane! : D – fedorqui Mar 4 '13 at 13:46
I add +1 to your commend – hudi Mar 4 '13 at 13:47
find /home/ -maxdepth 1 -type f -mtime +1 -exec mv -- '{}' /old/ +
share|improve this answer
ur command gives me error: find: missing argument to `-exec' – hudi Mar 4 '13 at 13:40
What does find --version say? And did you include the +? – melpomene Mar 4 '13 at 13:42
yes I include+ find (GNU findutils) 4.4.2 Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <>; This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Eric B. Decker, James Youngman, and Kevin Dalley. Built using GNU gnulib version e5573b1bad88bfabcda181b9e0125fb0c52b7d3b Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS() CBO(level=0) – hudi Mar 4 '13 at 13:43
+1 to this answer from me. -exec is the option provided for this exact reason. – anishsane Mar 4 '13 at 13:53
yea but this example doesnt work for me – hudi Mar 4 '13 at 14:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .