Skip to main content

find and mv files in bash

·51 words·1 min
Ronny Roethof
Author
Ronny Roethof
A security-minded sysadmin who fights corporate BS with open source weapons and sarcasm

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;

Related