2

The following command runs but the two -exec commands don't run - so the file gets moved but the permissions and file owner doesn't change.

find ~/Downloads/ -name "2014-12-24*" -exec sudo mv {} ~/docs/ \; -exec sudo chown {} apache:apache \; -exec sudo chmod {} 400 \;

BenjiWiebe
  • 9,173

1 Answers1

1

Your problem is that you are moving, say, Downloads/2014-12-24-first to ~/docs/2014-12-24-first, and THEN trying to change the owner and permissions on Downloads/2014-12-24-first; which will not work, because you have already moved the file to ~/docs.

Try re-ordering your -execs so the chmod/chown are first, and the mv last.

BenjiWiebe
  • 9,173