Skip to main content

find and mv files in bash

·51 words·1 min· loading · loading ·
Ronny Roethof
Author
Ronny Roethof
A little bit about you

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.

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