find and mv files in bash

Today I was working on an oldskool backup script and needed to move (not delete) old files, playing arround with find a bit and I thought I would document this shell command for posterity’s sake.

Shell

for i in $(find . -type f -mtime +1); do mv $i /[NEW DIRECTORY PATH]/; done;

1 Comment

  1. I needed to thank you for this great read!! I certainly loved
    every little bit of it. I’ve got you bookmarked to
    check out new stuff you

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.